2020-03-23 23:29:49 +02:00
|
|
|
#include "error.hh"
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using std::optional;
|
2020-03-24 19:21:35 +02:00
|
|
|
using std::nullopt;
|
2020-03-25 18:52:03 +02:00
|
|
|
using std::cout;
|
|
|
|
using std::endl;
|
2020-03-23 23:29:49 +02:00
|
|
|
|
2020-03-27 18:03:02 +02:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
using namespace nix;
|
2020-03-23 23:29:49 +02:00
|
|
|
|
2020-03-30 18:14:29 +03:00
|
|
|
ErrorInfo::programName = optional("error-test");
|
2020-03-25 18:52:03 +02:00
|
|
|
|
2020-03-31 20:56:37 +03:00
|
|
|
printErrorInfo(ProgramError()
|
2020-03-24 19:21:35 +02:00
|
|
|
.name("name")
|
2020-03-31 18:36:20 +03:00
|
|
|
.description("error description")
|
2020-03-27 18:03:02 +02:00
|
|
|
.nohint()
|
|
|
|
);
|
2020-03-24 19:21:35 +02:00
|
|
|
|
2020-03-31 20:56:37 +03:00
|
|
|
printErrorInfo(ProgramWarning()
|
2020-03-24 19:21:35 +02:00
|
|
|
.name("warning name")
|
2020-03-27 18:03:02 +02:00
|
|
|
.description("warning description")
|
|
|
|
.nohint()
|
|
|
|
);
|
2020-03-24 19:21:35 +02:00
|
|
|
|
|
|
|
|
2020-03-31 20:56:37 +03:00
|
|
|
printErrorInfo(NixLangWarning()
|
2020-03-24 22:24:57 +02:00
|
|
|
.name("warning name")
|
|
|
|
.description("warning description")
|
|
|
|
.nixFile("myfile.nix")
|
|
|
|
.lineNumber(40)
|
|
|
|
.columnRange(13,7)
|
|
|
|
.linesOfCode(nullopt
|
|
|
|
,"this is the problem line of code"
|
2020-03-30 18:14:29 +03:00
|
|
|
,nullopt)
|
|
|
|
.hint(hintfmt("this hint has %1% templated %2%!!") % "yellow" % "values")
|
|
|
|
);
|
2020-03-24 22:24:57 +02:00
|
|
|
|
2020-03-31 20:56:37 +03:00
|
|
|
printErrorInfo(NixLangError()
|
2020-03-24 22:24:57 +02:00
|
|
|
.name("error name")
|
2020-03-25 19:20:44 +02:00
|
|
|
.description("error description")
|
2020-03-24 22:24:57 +02:00
|
|
|
.nixFile("myfile.nix")
|
|
|
|
.lineNumber(40)
|
|
|
|
.columnRange(13,7)
|
2020-03-27 18:03:02 +02:00
|
|
|
.linesOfCode(optional("previous line of code")
|
2020-03-24 22:24:57 +02:00
|
|
|
,"this is the problem line of code"
|
2020-03-27 18:03:02 +02:00
|
|
|
,optional("next line of code"))
|
|
|
|
.hint(hintfmt("this hint has %1% templated %2%!!") % "yellow" % "values")
|
|
|
|
);
|
2020-03-24 17:18:23 +02:00
|
|
|
|
2020-03-23 23:29:49 +02:00
|
|
|
return 0;
|
|
|
|
}
|