summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-06-11 19:43:32 -0400
committerGitHub <noreply@github.com>2024-06-11 16:43:32 -0700
commit97b1bf9ac11848c2783264d22bf7cdb7f32a21cf (patch)
treeb8d5259e382badfdf4e857c4e12fb5d4da2f5bee /test/ruby
parentd1869cfb852cf95b5a51025c016437ab46b12104 (diff)
[Bug #20270] Fix --parser=prism (#10970)
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_rubyoptions.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 38ca119a8f..5fe8877666 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -287,17 +287,17 @@ class TestRubyOptions < Test::Unit::TestCase
end
end
- def test_parser_flag
- warning = /compiler based on the Prism parser is currently experimental/
+ PRISM_WARNING = /compiler based on the Prism parser is currently experimental/
- assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), warning)
+ def test_parser_flag
+ assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), PRISM_WARNING)
assert_in_out_err(%w(--parser=parse.y -e) + ["puts :hi"], "", %w(hi), [])
assert_norun_with_rflag('--parser=parse.y', '--version', "")
assert_in_out_err(%w(--parser=notreal -e) + ["puts :hi"], "", [], /unknown parser notreal/)
- assert_in_out_err(%w(--parser=prism --version), "", /\+PRISM/, warning)
+ assert_in_out_err(%w(--parser=prism --version), "", /\+PRISM/, PRISM_WARNING)
end
def test_eval
@@ -1140,6 +1140,7 @@ class TestRubyOptions < Test::Unit::TestCase
assert_norun_with_rflag('--dump=parsetree', '-e', '#frozen-string-literal: true')
assert_norun_with_rflag('--dump=parsetree+error_tolerant')
assert_norun_with_rflag('--dump=parse+error_tolerant')
+ assert_in_out_err(%w(--parser=prism --dump=parsetree -e ""), "", /ProgramNode/, PRISM_WARNING, encoding: "UTF-8")
end
def test_dump_insns_with_rflag