mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
error test
This commit is contained in:
parent
f694f43d7d
commit
aadd59d005
3 changed files with 64 additions and 13 deletions
39
tests/errors/main.cc
Normal file
39
tests/errors/main.cc
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "error.hh"
|
||||
|
||||
#include <optional>
|
||||
#include <iostream>
|
||||
|
||||
using std::optional;
|
||||
|
||||
int main() {
|
||||
|
||||
using namespace nix;
|
||||
|
||||
ColumnRange columnRange;
|
||||
columnRange.start = 24;
|
||||
columnRange.len = 14;
|
||||
|
||||
ErrLine errline;
|
||||
errline.lineNumber = 7;
|
||||
errline.columnRange = optional(columnRange);
|
||||
errline.errLineOfCode = "line of code where the error occurred";
|
||||
|
||||
NixCode nixcode;
|
||||
nixcode.nixFile = optional("myfile.nix");
|
||||
nixcode.errLine = errline;
|
||||
|
||||
ErrorInfo generic;
|
||||
generic.level = elError;
|
||||
generic.errName = "error name";
|
||||
generic.description = "general error description";
|
||||
generic.toolName = "nixtool.exe";
|
||||
generic.nixCode = nixcode;
|
||||
|
||||
print_error(generic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue