diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb index 1794773d89..3fc44234b9 100644 --- a/test/ripper/test_lexer.rb +++ b/test/ripper/test_lexer.rb @@ -138,4 +138,11 @@ class TestRipper::Lexer < Test::Unit::TestCase assert_equal pos, code.bytesize assert_equal expected.size, result.size end + + def test_trailing_on_embexpr_end + # This is useful for scanning a template engine literal `{ foo, bar: baz }` + # whose body inside brackes works like trailing method arguments, like Haml. + token = Ripper.lex("a( foo, bar: baz }").last + assert_equal [[1, 17], :on_embexpr_end, "}", state(:EXPR_ARG)], token + end end