mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
commit
ee1582494e
2 changed files with 23 additions and 1 deletions
|
@ -67,7 +67,11 @@ struct ErrPos {
|
||||||
{
|
{
|
||||||
line = pos.line;
|
line = pos.line;
|
||||||
column = pos.column;
|
column = pos.column;
|
||||||
file = pos.file;
|
// is file symbol null?
|
||||||
|
if (pos.file.set())
|
||||||
|
file = pos.file;
|
||||||
|
else
|
||||||
|
file = "";
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,4 +289,22 @@ namespace nix {
|
||||||
"what about this " ANSI_YELLOW "%3%" ANSI_NORMAL " " ANSI_YELLOW "one" ANSI_NORMAL);
|
"what about this " ANSI_YELLOW "%3%" ANSI_NORMAL " " ANSI_YELLOW "one" ANSI_NORMAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* ErrPos
|
||||||
|
* --------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
TEST(errpos, invalidPos) {
|
||||||
|
|
||||||
|
// contains an invalid symbol, which we should not dereference!
|
||||||
|
Pos invalid;
|
||||||
|
|
||||||
|
// constructing without access violation.
|
||||||
|
ErrPos ep(invalid);
|
||||||
|
|
||||||
|
// assignment without access violation.
|
||||||
|
ep = invalid;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue