From 0283d38cb4affa53123c9f7620a434ab663636fe Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Mon, 22 Aug 2022 21:37:28 -0700 Subject: [PATCH] Test {{oops} --- tests/Lexer.test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Lexer.test.cpp b/tests/Lexer.test.cpp index 0fafb130..890d100b 100644 --- a/tests/Lexer.test.cpp +++ b/tests/Lexer.test.cpp @@ -177,6 +177,22 @@ TEST_CASE("string_interpolation_double_brace") CHECK_EQ(std::string(interpEnd.data, interpEnd.length), std::string("}bar")); } +TEST_CASE("string_interpolation_double_but_unmatched_brace") +{ + ScopedFastFlag sff{"LuauInterpolatedStringBaseSupport", true}; + + const std::string testInput = R"(`{{oops}`, 1)"; + Luau::Allocator alloc; + AstNameTable table(alloc); + Lexer lexer(testInput.c_str(), testInput.size(), table); + + CHECK_EQ(lexer.next().type, Lexeme::BrokenInterpDoubleBrace); + CHECK_EQ(lexer.next().type, Lexeme::Name); + CHECK_EQ(lexer.next().type, Lexeme::InterpStringEnd); + CHECK_EQ(lexer.next().type, ','); + CHECK_EQ(lexer.next().type, Lexeme::Number); +} + TEST_CASE("string_interpolation_unmatched_brace") { ScopedFastFlag sff{"LuauInterpolatedStringBaseSupport", true};