Fix Lexer tests losing reference
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2019-06-13 19:21:22 +02:00
parent eb57a46b0b
commit 831dbe6917
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 4 additions and 2 deletions

View File

@ -8,14 +8,16 @@ TEST_CASE( "When at end of script return terminator", "[lexer]" ) {
}
TEST_CASE( "Peek doesn't advance", "[lexer]" ) {
Lexer lexer = Lexer("5 + 5", nullptr);
auto script = "5 + 5";
Lexer lexer = Lexer(script, nullptr);
REQUIRE(lexer.Peek() == '5');
REQUIRE(lexer.Peek() == '5');
REQUIRE(lexer.Peek() == '5');
}
TEST_CASE( "Next does advance", "[lexer]" ) {
Lexer lexer = Lexer("5 + 5", nullptr);
auto script = "5 + 5";
Lexer lexer = Lexer(script, nullptr);
REQUIRE(lexer.Next() == '5');
REQUIRE(lexer.Next() == ' ');
REQUIRE(lexer.Next() == '+');