From 8259f35adc67ab34bb521f0e8a298fb00629b958 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 15 Feb 2024 13:00:32 +0900 Subject: ruby-spec: Accept both a backtick and a single quote in error messages --- spec/ruby/language/numbered_parameters_spec.rb | 2 +- spec/ruby/language/predefined_spec.rb | 4 ++-- spec/ruby/language/rescue_spec.rb | 2 +- spec/ruby/language/variables_spec.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/ruby/language') diff --git a/spec/ruby/language/numbered_parameters_spec.rb b/spec/ruby/language/numbered_parameters_spec.rb index 3a35cf1465..06f9948c58 100644 --- a/spec/ruby/language/numbered_parameters_spec.rb +++ b/spec/ruby/language/numbered_parameters_spec.rb @@ -22,7 +22,7 @@ describe "Numbered parameters" do it "does not support more than 9 parameters" do -> { proc { [_10] }.call(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - }.should raise_error(NameError, /undefined local variable or method `_10'/) + }.should raise_error(NameError, /undefined local variable or method [`']_10'/) end it "can not be used in both outer and nested blocks at the same time" do diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb index fe865cc325..ed823f185a 100644 --- a/spec/ruby/language/predefined_spec.rb +++ b/spec/ruby/language/predefined_spec.rb @@ -687,7 +687,7 @@ describe "Predefined global $," do end it "warns if assigned non-nil" do - -> { $, = "_" }.should complain(/warning: `\$,' is deprecated/) + -> { $, = "_" }.should complain(/warning: [`']\$,' is deprecated/) end end @@ -724,7 +724,7 @@ describe "Predefined global $;" do end it "warns if assigned non-nil" do - -> { $; = "_" }.should complain(/warning: `\$;' is deprecated/) + -> { $; = "_" }.should complain(/warning: [`']\$;' is deprecated/) end end diff --git a/spec/ruby/language/rescue_spec.rb b/spec/ruby/language/rescue_spec.rb index 69ed038fda..d8ba14378f 100644 --- a/spec/ruby/language/rescue_spec.rb +++ b/spec/ruby/language/rescue_spec.rb @@ -263,7 +263,7 @@ describe "The rescue keyword" do rescue ArgumentError end rescue StandardError => e - e.backtrace.first.should include ":in `raise_standard_error'" + e.backtrace.first.should =~ /:in [`']raise_standard_error'/ else fail("exception wasn't handled by the correct rescue block") end diff --git a/spec/ruby/language/variables_spec.rb b/spec/ruby/language/variables_spec.rb index 53d191b456..01be61a9dc 100644 --- a/spec/ruby/language/variables_spec.rb +++ b/spec/ruby/language/variables_spec.rb @@ -930,7 +930,7 @@ describe "Instance variables" do obj = Object.new def obj.foobar; a = $specs_uninitialized_global_variable; end - -> { obj.foobar }.should complain(/warning: global variable `\$specs_uninitialized_global_variable' not initialized/, verbose: true) + -> { obj.foobar }.should complain(/warning: global variable [`']\$specs_uninitialized_global_variable' not initialized/, verbose: true) end it "doesn't warn at lazy initialization" do -- cgit v1.2.3