Fix for release builds deleting lexer test script strings before being finished with it
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a9def6c539
commit
3217fd1479
|
@ -8,16 +8,16 @@ TEST_CASE( "When at end of script return terminator", "[lexer]" ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "Peek doesn't advance", "[lexer]" ) {
|
TEST_CASE( "Peek doesn't advance", "[lexer]" ) {
|
||||||
auto script = "5 + 5";
|
auto script = new string("5 + 5"); // Create as reference to ensure the compiler plays nice with it in release builds
|
||||||
Lexer lexer = Lexer(script, nullptr);
|
Lexer lexer = Lexer(*script, nullptr);
|
||||||
REQUIRE(lexer.Peek() == '5');
|
REQUIRE(lexer.Peek() == '5');
|
||||||
REQUIRE(lexer.Peek() == '5');
|
REQUIRE(lexer.Peek() == '5');
|
||||||
REQUIRE(lexer.Peek() == '5');
|
REQUIRE(lexer.Peek() == '5');
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "Next does advance", "[lexer]" ) {
|
TEST_CASE( "Next does advance", "[lexer]" ) {
|
||||||
auto script = "5 + 5";
|
auto script = new string("5 + 5"); // Create as reference to ensure the compiler plays nice with it in release builds
|
||||||
Lexer lexer = Lexer(script, nullptr);
|
Lexer lexer = Lexer(*script, nullptr);
|
||||||
REQUIRE(lexer.Next() == '5');
|
REQUIRE(lexer.Next() == '5');
|
||||||
REQUIRE(lexer.Next() == ' ');
|
REQUIRE(lexer.Next() == ' ');
|
||||||
REQUIRE(lexer.Next() == '+');
|
REQUIRE(lexer.Next() == '+');
|
||||||
|
|
Loading…
Reference in New Issue