diff --git a/tests/parser/LexerTests.cpp b/tests/parser/LexerTests.cpp index 763be63..1591b7c 100644 --- a/tests/parser/LexerTests.cpp +++ b/tests/parser/LexerTests.cpp @@ -8,16 +8,16 @@ TEST_CASE( "When at end of script return terminator", "[lexer]" ) { } TEST_CASE( "Peek doesn't advance", "[lexer]" ) { - auto script = "5 + 5"; - Lexer lexer = Lexer(script, nullptr); + 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); REQUIRE(lexer.Peek() == '5'); REQUIRE(lexer.Peek() == '5'); REQUIRE(lexer.Peek() == '5'); } TEST_CASE( "Next does advance", "[lexer]" ) { - auto script = "5 + 5"; - Lexer lexer = Lexer(script, nullptr); + 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); REQUIRE(lexer.Next() == '5'); REQUIRE(lexer.Next() == ' '); REQUIRE(lexer.Next() == '+');