diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-12-01 12:06:57 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-01 18:46:52 +0000 |
commit | ec83bd7356d639fe34f6843c4f1805c63cfdfa49 (patch) | |
tree | 3e1fad8fb3f5734f352154fa9adb912940eb2c42 /test/prism/ruby_api_test.rb | |
parent | 2a8d9c59ff151e8e2274e5f788745e070111b8ab (diff) | |
download | ruby-ec83bd7356d639fe34f6843c4f1805c63cfdfa49.tar.gz |
[ruby/prism] Provide heredoc? queries
https://github.com/ruby/prism/commit/e148e8fe6a
Diffstat (limited to 'test/prism/ruby_api_test.rb')
-rw-r--r-- | test/prism/ruby_api_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/prism/ruby_api_test.rb b/test/prism/ruby_api_test.rb index cd87a81395..54c5fd28e9 100644 --- a/test/prism/ruby_api_test.rb +++ b/test/prism/ruby_api_test.rb @@ -103,6 +103,18 @@ module Prism assert_equal 7, location.end_character_column end + def test_heredoc? + refute parse_expression("\"foo\"").heredoc? + refute parse_expression("\"foo \#{1}\"").heredoc? + refute parse_expression("`foo`").heredoc? + refute parse_expression("`foo \#{1}`").heredoc? + + assert parse_expression("<<~HERE\nfoo\nHERE\n").heredoc? + assert parse_expression("<<~HERE\nfoo \#{1}\nHERE\n").heredoc? + assert parse_expression("<<~`HERE`\nfoo\nHERE\n").heredoc? + assert parse_expression("<<~`HERE`\nfoo \#{1}\nHERE\n").heredoc? + end + private def parse_expression(source) |