mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add a Ripper.lex test of :on_embexpr_end
This is a weird use case of Ripper.lex which I'm not sure is supposed to be maintained, so I'm adding this test so that we can easily notice such changes. If we change the behavior, this will break the behavior of hamlit.gem v1 and code like https://github.com/haml/haml/pull/1043.
This commit is contained in:
parent
a76a30724d
commit
4a7dccf44f
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue