diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/marshal/test_internal_ivar.rb | 2 | ||||
-rw-r--r-- | test/-ext-/test_bug-3571.rb | 4 | ||||
-rw-r--r-- | test/did_you_mean/core_ext/test_name_error_extension.rb | 2 | ||||
-rw-r--r-- | test/error_highlight/test_error_highlight.rb | 18 | ||||
-rw-r--r-- | test/irb/test_context.rb | 106 | ||||
-rw-r--r-- | test/irb/test_eval_history.rb | 2 | ||||
-rw-r--r-- | test/irb/test_raise_exception.rb | 2 | ||||
-rw-r--r-- | test/ripper/test_lexer.rb | 2 | ||||
-rw-r--r-- | test/ripper/test_parser_events.rb | 16 | ||||
-rw-r--r-- | test/ruby/test_backtrace.rb | 22 | ||||
-rw-r--r-- | test/ruby/test_beginendblock.rb | 2 | ||||
-rw-r--r-- | test/ruby/test_class.rb | 6 | ||||
-rw-r--r-- | test/ruby/test_exception.rb | 10 | ||||
-rw-r--r-- | test/ruby/test_iseq.rb | 6 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_nomethod_error.rb | 2 | ||||
-rw-r--r-- | test/ruby/test_object.rb | 6 | ||||
-rw-r--r-- | test/ruby/test_parse.rb | 22 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 14 | ||||
-rw-r--r-- | test/ruby/test_settracefunc.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 18 | ||||
-rw-r--r-- | test/rubygems/test_rubygems.rb | 2 | ||||
-rw-r--r-- | test/test_forwardable.rb | 2 |
24 files changed, 146 insertions, 132 deletions
diff --git a/test/-ext-/marshal/test_internal_ivar.rb b/test/-ext-/marshal/test_internal_ivar.rb index a32138f6e8..faabe14ab2 100644 --- a/test/-ext-/marshal/test_internal_ivar.rb +++ b/test/-ext-/marshal/test_internal_ivar.rb @@ -11,7 +11,7 @@ module Bug::Marshal assert_equal("hello", v.normal) assert_equal("world", v.internal) assert_equal("bye", v.encoding_short) - dump = assert_warn(/instance variable `E' on class \S+ is not dumped/) { + dump = assert_warn(/instance variable 'E' on class \S+ is not dumped/) { ::Marshal.dump(v) } v = assert_nothing_raised {break ::Marshal.load(dump)} diff --git a/test/-ext-/test_bug-3571.rb b/test/-ext-/test_bug-3571.rb index c75d2e8523..9e8c5cfe5c 100644 --- a/test/-ext-/test_bug-3571.rb +++ b/test/-ext-/test_bug-3571.rb @@ -13,8 +13,8 @@ end SRC out = [ "start() function is unimplemented on this machine", - "-:2:in `start'", - "-:2:in `<main>'", + "-:2:in 'start'", + "-:2:in '<main>'", ] assert_in_out_err(%w"-r-test-/bug_3571", src, [], out, bug3571) end diff --git a/test/did_you_mean/core_ext/test_name_error_extension.rb b/test/did_you_mean/core_ext/test_name_error_extension.rb index c58b78455f..116c7cd7b9 100644 --- a/test/did_you_mean/core_ext/test_name_error_extension.rb +++ b/test/did_you_mean/core_ext/test_name_error_extension.rb @@ -49,7 +49,7 @@ class NameErrorExtensionTest < Test::Unit::TestCase get_message(error) - assert_match(/^undefined method `sizee' for /, + assert_match(/^undefined method [`']sizee' for /, Marshal.load(Marshal.dump(error)).original_message) end end diff --git a/test/error_highlight/test_error_highlight.rb b/test/error_highlight/test_error_highlight.rb index 006ecb05bf..2095970af1 100644 --- a/test/error_highlight/test_error_highlight.rb +++ b/test/error_highlight/test_error_highlight.rb @@ -23,17 +23,31 @@ class ErrorHighlightTest < Test::Unit::TestCase end end + begin + method_not_exist + rescue NameError + if $!.message.include?("`") + def preprocess(msg) + msg + end + else + def preprocess(msg) + msg.sub("`", "'") + end + end + end + if Exception.method_defined?(:detailed_message) def assert_error_message(klass, expected_msg, &blk) omit unless klass < ErrorHighlight::CoreExt err = assert_raise(klass, &blk) - assert_equal(expected_msg.chomp, err.detailed_message(highlight: false).sub(/ \((?:NoMethod|Name)Error\)/, "")) + assert_equal(preprocess(expected_msg).chomp, err.detailed_message(highlight: false).sub(/ \((?:NoMethod|Name)Error\)/, "")) end else def assert_error_message(klass, expected_msg, &blk) omit unless klass < ErrorHighlight::CoreExt err = assert_raise(klass, &blk) - assert_equal(expected_msg.chomp, err.message) + assert_equal(preprocess(expected_msg).chomp, err.message) end end diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index adf472baae..fde1f91c40 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -68,7 +68,7 @@ module TestIRB irb.eval_input end assert_empty err - assert_pattern_list([:*, /\(irb\):1:in `<main>': Foo \(RuntimeError\)\n/, + assert_pattern_list([:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/, :*, /#<RuntimeError: Foo>\n/, :*, /0$/, :*, /0$/, @@ -89,8 +89,8 @@ module TestIRB end assert_empty err assert_pattern_list([ - :*, /\(irb\):1:in `<main>': Foo \(RuntimeError\)\n/, - :*, /\(irb\):2:in `<main>': Bar \(RuntimeError\)\n/, + :*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/, + :*, /\(irb\):2:in '<main>': Bar \(RuntimeError\)\n/, :*, /#<RuntimeError: Bar>\n/, ], out) end @@ -130,9 +130,9 @@ module TestIRB [:marshal, "123", Marshal.dump(123)], ], failed: [ - [false, "BasicObject.new", /#<NoMethodError: undefined method `to_s' for/], - [:p, "class Foo; undef inspect ;end; Foo.new", /#<NoMethodError: undefined method `inspect' for/], - [:yaml, "BasicObject.new", /#<NoMethodError: undefined method `inspect' for/], + [false, "BasicObject.new", /#<NoMethodError: undefined method 'to_s' for/], + [:p, "class Foo; undef inspect ;end; Foo.new", /#<NoMethodError: undefined method 'inspect' for/], + [:yaml, "BasicObject.new", /#<NoMethodError: undefined method 'inspect' for/], [:marshal, "[Object.new, Class.new]", /#<TypeError: can't dump anonymous class #<Class:/] ] }.each do |scenario, cases| @@ -210,7 +210,7 @@ module TestIRB end assert_empty err assert_match(/An error occurred when inspecting the object: #<RuntimeError: foo>/, out) - assert_match(/An error occurred when running Kernel#inspect: #<NoMethodError: undefined method `inspect' for/, out) + assert_match(/An error occurred when running Kernel#inspect: #<NoMethodError: undefined method 'inspect' for/, out) ensure $VERBOSE = verbose end @@ -503,15 +503,15 @@ module TestIRB if RUBY_VERSION < '3.0.0' && STDOUT.tty? expected = [ :*, /Traceback \(most recent call last\):\n/, - :*, /\t 2: from \(irb\):1:in `<main>'\n/, - :*, /\t 1: from \(irb\):1:in `hoge'\n/, - :*, /\(irb\):1:in `fuga': unhandled exception\n/, + :*, /\t 2: from \(irb\):1:in '<main>'\n/, + :*, /\t 1: from \(irb\):1:in 'hoge'\n/, + :*, /\(irb\):1:in 'fuga': unhandled exception\n/, ] else expected = [ - :*, /\(irb\):1:in `fuga': unhandled exception\n/, - :*, /\tfrom \(irb\):1:in `hoge'\n/, - :*, /\tfrom \(irb\):1:in `<main>'\n/, + :*, /\(irb\):1:in 'fuga': unhandled exception\n/, + :*, /\tfrom \(irb\):1:in 'hoge'\n/, + :*, /\tfrom \(irb\):1:in '<main>'\n/, :* ] end @@ -533,15 +533,15 @@ module TestIRB if RUBY_VERSION < '3.0.0' && STDOUT.tty? expected = [ :*, /Traceback \(most recent call last\):\n/, - :*, /\t 2: from \(irb\):1:in `<main>'\n/, - :*, /\t 1: from \(irb\):1:in `hoge'\n/, - :*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/, + :*, /\t 2: from \(irb\):1:in '<main>'\n/, + :*, /\t 1: from \(irb\):1:in 'hoge'\n/, + :*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/, ] else expected = [ - :*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/, - :*, /\tfrom \(irb\):1:in `hoge'\n/, - :*, /\tfrom \(irb\):1:in `<main>'\n/, + :*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/, + :*, /\tfrom \(irb\):1:in 'hoge'\n/, + :*, /\tfrom \(irb\):1:in '<main>'\n/, :* ] end @@ -571,43 +571,43 @@ module TestIRB expected = [ :*, /Traceback \(most recent call last\):\n/, :*, /\t... \d+ levels...\n/, - :*, /\t16: from \(irb\):1:in `a4'\n/, - :*, /\t15: from \(irb\):1:in `a5'\n/, - :*, /\t14: from \(irb\):1:in `a6'\n/, - :*, /\t13: from \(irb\):1:in `a7'\n/, - :*, /\t12: from \(irb\):1:in `a8'\n/, - :*, /\t11: from \(irb\):1:in `a9'\n/, - :*, /\t10: from \(irb\):1:in `a10'\n/, - :*, /\t 9: from \(irb\):1:in `a11'\n/, - :*, /\t 8: from \(irb\):1:in `a12'\n/, - :*, /\t 7: from \(irb\):1:in `a13'\n/, - :*, /\t 6: from \(irb\):1:in `a14'\n/, - :*, /\t 5: from \(irb\):1:in `a15'\n/, - :*, /\t 4: from \(irb\):1:in `a16'\n/, - :*, /\t 3: from \(irb\):1:in `a17'\n/, - :*, /\t 2: from \(irb\):1:in `a18'\n/, - :*, /\t 1: from \(irb\):1:in `a19'\n/, - :*, /\(irb\):1:in `a20': unhandled exception\n/, + :*, /\t16: from \(irb\):1:in 'a4'\n/, + :*, /\t15: from \(irb\):1:in 'a5'\n/, + :*, /\t14: from \(irb\):1:in 'a6'\n/, + :*, /\t13: from \(irb\):1:in 'a7'\n/, + :*, /\t12: from \(irb\):1:in 'a8'\n/, + :*, /\t11: from \(irb\):1:in 'a9'\n/, + :*, /\t10: from \(irb\):1:in 'a10'\n/, + :*, /\t 9: from \(irb\):1:in 'a11'\n/, + :*, /\t 8: from \(irb\):1:in 'a12'\n/, + :*, /\t 7: from \(irb\):1:in 'a13'\n/, + :*, /\t 6: from \(irb\):1:in 'a14'\n/, + :*, /\t 5: from \(irb\):1:in 'a15'\n/, + :*, /\t 4: from \(irb\):1:in 'a16'\n/, + :*, /\t 3: from \(irb\):1:in 'a17'\n/, + :*, /\t 2: from \(irb\):1:in 'a18'\n/, + :*, /\t 1: from \(irb\):1:in 'a19'\n/, + :*, /\(irb\):1:in 'a20': unhandled exception\n/, ] else expected = [ - :*, /\(irb\):1:in `a20': unhandled exception\n/, - :*, /\tfrom \(irb\):1:in `a19'\n/, - :*, /\tfrom \(irb\):1:in `a18'\n/, - :*, /\tfrom \(irb\):1:in `a17'\n/, - :*, /\tfrom \(irb\):1:in `a16'\n/, - :*, /\tfrom \(irb\):1:in `a15'\n/, - :*, /\tfrom \(irb\):1:in `a14'\n/, - :*, /\tfrom \(irb\):1:in `a13'\n/, - :*, /\tfrom \(irb\):1:in `a12'\n/, - :*, /\tfrom \(irb\):1:in `a11'\n/, - :*, /\tfrom \(irb\):1:in `a10'\n/, - :*, /\tfrom \(irb\):1:in `a9'\n/, - :*, /\tfrom \(irb\):1:in `a8'\n/, - :*, /\tfrom \(irb\):1:in `a7'\n/, - :*, /\tfrom \(irb\):1:in `a6'\n/, - :*, /\tfrom \(irb\):1:in `a5'\n/, - :*, /\tfrom \(irb\):1:in `a4'\n/, + :*, /\(irb\):1:in 'a20': unhandled exception\n/, + :*, /\tfrom \(irb\):1:in 'a19'\n/, + :*, /\tfrom \(irb\):1:in 'a18'\n/, + :*, /\tfrom \(irb\):1:in 'a17'\n/, + :*, /\tfrom \(irb\):1:in 'a16'\n/, + :*, /\tfrom \(irb\):1:in 'a15'\n/, + :*, /\tfrom \(irb\):1:in 'a14'\n/, + :*, /\tfrom \(irb\):1:in 'a13'\n/, + :*, /\tfrom \(irb\):1:in 'a12'\n/, + :*, /\tfrom \(irb\):1:in 'a11'\n/, + :*, /\tfrom \(irb\):1:in 'a10'\n/, + :*, /\tfrom \(irb\):1:in 'a9'\n/, + :*, /\tfrom \(irb\):1:in 'a8'\n/, + :*, /\tfrom \(irb\):1:in 'a7'\n/, + :*, /\tfrom \(irb\):1:in 'a6'\n/, + :*, /\tfrom \(irb\):1:in 'a5'\n/, + :*, /\tfrom \(irb\):1:in 'a4'\n/, :*, /\t... \d+ levels...\n/, ] end diff --git a/test/irb/test_eval_history.rb b/test/irb/test_eval_history.rb index a6ab36fb8b..0e2259e821 100644 --- a/test/irb/test_eval_history.rb +++ b/test/irb/test_eval_history.rb @@ -37,7 +37,7 @@ module TestIRB ) assert_empty(err) - assert_match(/undefined local variable or method `__'/, out) + assert_match(/undefined local variable or method [`']__'/, out) end def test_eval_history_can_be_retrieved_with_double_underscore diff --git a/test/irb/test_raise_exception.rb b/test/irb/test_raise_exception.rb index c373dd7335..a6b1e8368d 100644 --- a/test/irb/test_raise_exception.rb +++ b/test/irb/test_raise_exception.rb @@ -61,7 +61,7 @@ IRB # TruffleRuby warns when the locale does not exist env['TRUFFLERUBYOPT'] = "#{ENV['TRUFFLERUBYOPT']} --log.level=SEVERE" if RUBY_ENGINE == 'truffleruby' args = [env] + bundle_exec + %W[-rirb -C #{tmpdir} -W0 -e IRB.start(__FILE__) -- -f --] - error = /`raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/ + error = /[`']raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/ assert_in_out_err(args, <<~IRB, error, [], encoding: "UTF-8") require_relative 'euc' raise_euc_with_invalid_byte_sequence diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb index 7bff858705..7d62a7ee28 100644 --- a/test/ripper/test_lexer.rb +++ b/test/ripper/test_lexer.rb @@ -171,7 +171,7 @@ class TestRipper::Lexer < Test::Unit::TestCase end BAD_CODE = [ - [:parse_error, 'def req(true) end', %r[unexpected `true'], 'true'], + [:parse_error, 'def req(true) end', %r[unexpected 'true'], 'true'], [:parse_error, 'def req(a, a) end', %r[duplicated argument name], 'a'], [:assign_error, 'begin; nil = 1; end', %r[assign to nil], 'nil'], [:alias_error, 'begin; alias $x $1; end', %r[number variables], '$1'], diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 8a7782820b..9283a4d343 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -1644,20 +1644,20 @@ class TestRipper::ParserEvents < Test::Unit::TestCase end def test_invalid_instance_variable_name - assert_equal("`@1' is not allowed as an instance variable name", compile_error('proc{@1}')) - assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@%')) - assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@')) + assert_equal("'@1' is not allowed as an instance variable name", compile_error('proc{@1}')) + assert_equal("'@' without identifiers is not allowed as an instance variable name", compile_error('@%')) + assert_equal("'@' without identifiers is not allowed as an instance variable name", compile_error('@')) end def test_invalid_class_variable_name - assert_equal("`@@1' is not allowed as a class variable name", compile_error('@@1')) - assert_equal("`@@' without identifiers is not allowed as a class variable name", compile_error('@@%')) - assert_equal("`@@' without identifiers is not allowed as a class variable name", compile_error('@@')) + assert_equal("'@@1' is not allowed as a class variable name", compile_error('@@1')) + assert_equal("'@@' without identifiers is not allowed as a class variable name", compile_error('@@%')) + assert_equal("'@@' without identifiers is not allowed as a class variable name", compile_error('@@')) end def test_invalid_global_variable_name - assert_equal("`$%' is not allowed as a global variable name", compile_error('$%')) - assert_equal("`$' without identifiers is not allowed as a global variable name", compile_error('$')) + assert_equal("'$%' is not allowed as a global variable name", compile_error('$%')) + assert_equal("'$' without identifiers is not allowed as a global variable name", compile_error('$')) end def test_warning_ignored_magic_comment diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb index 844ec0e30c..c4b9d50c8b 100644 --- a/test/ruby/test_backtrace.rb +++ b/test/ruby/test_backtrace.rb @@ -216,7 +216,7 @@ class TestBacktrace < Test::Unit::TestCase end @line = __LINE__ + 1 [1].map.map { [1].map.map { foo } } - assert_equal("[\"#{__FILE__}:#{@line}:in `map'\"]", @res) + assert_equal("[\"#{__FILE__}:#{@line}:in 'map'\"]", @res) end def test_caller_location_path_cfunc_iseq_no_pc @@ -384,11 +384,11 @@ class TestBacktrace < Test::Unit::TestCase end def test_notty_backtrace - err = ["-:1:in `<main>': unhandled exception"] + err = ["-:1:in '<main>': unhandled exception"] assert_in_out_err([], "raise", [], err) - err = ["-:2:in `foo': foo! (RuntimeError)", - "\tfrom -:4:in `<main>'"] + err = ["-:2:in 'foo': foo! (RuntimeError)", + "\tfrom -:4:in '<main>'"] assert_in_out_err([], <<-"end;", [], err) def foo raise "foo!" @@ -396,12 +396,12 @@ class TestBacktrace < Test::Unit::TestCase foo end; - err = ["-:7:in `rescue in bar': bar! (RuntimeError)", - "\tfrom -:4:in `bar'", - "\tfrom -:9:in `<main>'", - "-:2:in `foo': foo! (RuntimeError)", - "\tfrom -:5:in `bar'", - "\tfrom -:9:in `<main>'"] + err = ["-:7:in 'rescue in bar': bar! (RuntimeError)", + "\tfrom -:4:in 'bar'", + "\tfrom -:9:in '<main>'", + "-:2:in 'foo': foo! (RuntimeError)", + "\tfrom -:5:in 'bar'", + "\tfrom -:9:in '<main>'"] assert_in_out_err([], <<-"end;", [], err) def foo raise "foo!" @@ -416,7 +416,7 @@ class TestBacktrace < Test::Unit::TestCase end def test_caller_to_enum - err = ["-:3:in `foo': unhandled exception", "\tfrom -:in `each'"] + err = ["-:3:in 'foo': unhandled exception", "\tfrom -:in 'each'"] assert_in_out_err([], <<-"end;", [], err, "[ruby-core:91911]") def foo return to_enum(__method__) unless block_given? diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 301a746f4a..3ee1f97e58 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -67,7 +67,7 @@ class TestBeginEndBlock < Test::Unit::TestCase bug8501 = '[ruby-core:55365] [Bug #8501]' args = ['-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end', '-e', 'at_exit{o.nope}'] - status = assert_in_out_err(args, '', [], /undefined method `nope'/, bug8501) + status = assert_in_out_err(args, '', [], /undefined method 'nope'/, bug8501) assert_not_predicate(status, :success?, bug8501) end diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index a8a019cee2..710b8a6f7b 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -789,15 +789,15 @@ class TestClass < Test::Unit::TestCase c.attached_object end - assert_raise_with_message(TypeError, /`NilClass' is not a singleton class/) do + assert_raise_with_message(TypeError, /'NilClass' is not a singleton class/) do nil.singleton_class.attached_object end - assert_raise_with_message(TypeError, /`FalseClass' is not a singleton class/) do + assert_raise_with_message(TypeError, /'FalseClass' is not a singleton class/) do false.singleton_class.attached_object end - assert_raise_with_message(TypeError, /`TrueClass' is not a singleton class/) do + assert_raise_with_message(TypeError, /'TrueClass' is not a singleton class/) do true.singleton_class.attached_object end end diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 84c750bf32..c5f7a94a77 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -809,7 +809,7 @@ end.join def test_cause_at_end errs = [ /-: unexpected return\n/, - /.*undefined local variable or method `n'.*\n/, + /.*undefined local variable or method 'n'.*\n/, ] assert_in_out_err([], <<-'end;', [], errs) END{n}; END{return} @@ -1045,7 +1045,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end def test_message_of_name_error - assert_raise_with_message(NameError, /\Aundefined method `foo' for module `#<Module:.*>'$/) do + assert_raise_with_message(NameError, /\Aundefined method 'foo' for module '#<Module:.*>'$/) do Module.new do module_function :foo end @@ -1093,7 +1093,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| def test_warning_warn warning = capture_warning_warn {$asdfasdsda_test_warning_warn} - assert_match(/global variable `\$asdfasdsda_test_warning_warn' not initialized/, warning[0]) + assert_match(/global variable '\$asdfasdsda_test_warning_warn' not initialized/, warning[0]) assert_equal(["a\nz\n"], capture_warning_warn {warn "a\n", "z"}) assert_equal([], capture_warning_warn {warn}) @@ -1169,7 +1169,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end def test_warning_warn_super - assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /global variable `\$asdfiasdofa_test_warning_warn_super' not initialized/) + assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /global variable '\$asdfiasdofa_test_warning_warn_super' not initialized/) {# module Warning def warn(message) @@ -1443,7 +1443,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end bug14670 = '[ruby-dev:50522] [Bug #14670]' - assert_raise_with_message(NoMethodError, /`foo'/, bug14670) do + assert_raise_with_message(NoMethodError, /'foo'/, bug14670) do Object.new.foo end end; diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 35bf36e492..9b584c540c 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -157,12 +157,12 @@ class TestISeq < Test::Unit::TestCase y = nil.instance_eval do eval("proc {#{name} = []; proc {|x| #{name}}}").call end - assert_raise_with_message(Ractor::IsolationError, /`#{name}'/) do + assert_raise_with_message(Ractor::IsolationError, /'#{name}'/) do Ractor.make_shareable(y) end obj = Object.new def obj.foo(*) nil.instance_eval{ ->{super} } end - assert_raise_with_message(Ractor::IsolationError, /refer unshareable object \[\] from variable `\*'/) do + assert_raise_with_message(Ractor::IsolationError, /refer unshareable object \[\] from variable '\*'/) do Ractor.make_shareable(obj.foo) end end @@ -367,7 +367,7 @@ class TestISeq < Test::Unit::TestCase f.puts "end" f.close path = f.path - assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /unexpected `end'/, [], success: true) + assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /unexpected 'end'/, [], success: true) begin; path = ARGV[0] begin diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index b22dd9cbee..fd05fde3da 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -1453,12 +1453,12 @@ class TestMethod < Test::Unit::TestCase begin $f.call(1) rescue ArgumentError => e - assert_equal "main.rb:#{$line_lambda}:in `block in <main>'", e.backtrace.first + assert_equal "main.rb:#{$line_lambda}:in 'block in <main>'", e.backtrace.first end begin foo(1) rescue ArgumentError => e - assert_equal "main.rb:#{$line_method}:in `foo'", e.backtrace.first + assert_equal "main.rb:#{$line_method}:in 'foo'", e.backtrace.first end EOS END_OF_BODY diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 4722fa22e0..75d8d909d7 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1477,7 +1477,7 @@ class TestModule < Test::Unit::TestCase end %w(object_id __send__ initialize).each do |n| - assert_in_out_err([], <<-INPUT, [], %r"warning: undefining `#{n}' may cause serious problems$") + assert_in_out_err([], <<-INPUT, [], %r"warning: undefining '#{n}' may cause serious problems$") $VERBOSE = false Class.new.instance_eval { undef_method(:#{n}) } INPUT @@ -3348,7 +3348,7 @@ class TestModule < Test::Unit::TestCase methods = singleton_class.private_instance_methods(false) assert_include(methods, :#{method}, ":#{method} should be private") - assert_raise_with_message(NoMethodError, /^private method `#{method}' called for /) { + assert_raise_with_message(NoMethodError, /^private method '#{method}' called for /) { recv = self recv.#{method} } diff --git a/test/ruby/test_nomethod_error.rb b/test/ruby/test_nomethod_error.rb index 0306535943..6d413e6391 100644 --- a/test/ruby/test_nomethod_error.rb +++ b/test/ruby/test_nomethod_error.rb @@ -85,7 +85,7 @@ class TestNoMethodError < Test::Unit::TestCase bug3237 = '[ruby-core:29948]' str = "\u2600" id = :"\u2604" - msg = "undefined method `#{id}' for an instance of String" + msg = "undefined method '#{id}' for an instance of String" assert_raise_with_message(NoMethodError, Regexp.compile(Regexp.quote(msg)), bug3237) do str.__send__(id) end diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 0bb9e633a1..37c09596a2 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -480,12 +480,12 @@ class TestObject < Test::Unit::TestCase end def test_redefine_method_which_may_case_serious_problem - assert_in_out_err([], <<-INPUT, [], %r"warning: redefining `object_id' may cause serious problems$") + assert_in_out_err([], <<-INPUT, [], %r"warning: redefining 'object_id' may cause serious problems$") $VERBOSE = false def (Object.new).object_id; end INPUT - assert_in_out_err([], <<-INPUT, [], %r"warning: redefining `__send__' may cause serious problems$") + assert_in_out_err([], <<-INPUT, [], %r"warning: redefining '__send__' may cause serious problems$") $VERBOSE = false def (Object.new).__send__; end INPUT @@ -528,7 +528,7 @@ class TestObject < Test::Unit::TestCase assert_raise(NoMethodError, bug2202) {o2.meth2} %w(object_id __send__ initialize).each do |m| - assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing `#{m}' may cause serious problems$") + assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing '#{m}' may cause serious problems$") $VERBOSE = false begin Class.new.instance_eval { remove_method(:#{m}) } diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 325519fd80..e74406b843 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -378,10 +378,10 @@ class TestParse < Test::Unit::TestCase def assert_disallowed_variable(type, noname, invalid) noname.each do |name| - assert_syntax_error("proc{a = #{name} }", "`#{noname[0]}' without identifiers is not allowed as #{type} variable name") + assert_syntax_error("proc{a = #{name} }", "'#{noname[0]}' without identifiers is not allowed as #{type} variable name") end invalid.each do |name| - assert_syntax_error("proc {a = #{name} }", "`#{name}' is not allowed as #{type} variable name") + assert_syntax_error("proc {a = #{name} }", "'#{name}' is not allowed as #{type} variable name") end end @@ -854,7 +854,7 @@ x = __ENCODING__ def test_float assert_predicate(assert_warning(/out of range/) {eval("1e10000")}, :infinite?) - assert_syntax_error('1_E', /trailing `_'/) + assert_syntax_error('1_E', /trailing '_'/) assert_syntax_error('1E1E1', /unexpected constant/) end @@ -882,7 +882,7 @@ x = __ENCODING__ def test_invalid_char bug10117 = '[ruby-core:64243] [Bug #10117]' - invalid_char = /Invalid char `\\x01'/ + invalid_char = /Invalid char '\\x01'/ x = 1 assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117) assert_syntax_error("\x01x", invalid_char, bug10117) @@ -952,14 +952,14 @@ x = __ENCODING__ def test_assign_in_conditional # multiple assignment - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 (x, y = 1, 2) ? 1 : 2 END end # instance variable assignment - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 if @x = true 1 @@ -970,7 +970,7 @@ x = __ENCODING__ end # local variable assignment - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 def m if x = true @@ -984,7 +984,7 @@ x = __ENCODING__ # global variable assignment assert_separately([], <<-RUBY) - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 if $x = true 1 @@ -996,7 +996,7 @@ x = __ENCODING__ RUBY # dynamic variable assignment - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 y = 1 @@ -1011,7 +1011,7 @@ x = __ENCODING__ end # class variable assignment - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 c = Class.new class << c @@ -1023,7 +1023,7 @@ x = __ENCODING__ # constant declaration assert_separately([], <<-RUBY) - assert_warning(/`= literal' in conditional/) do + assert_warning(/'= literal' in conditional/) do eval <<-END, nil, __FILE__, __LINE__+1 if Const = true 1 diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index f753ba5574..0406efea79 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -117,7 +117,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(-W:no-experimental -e) + ['p Warning[:experimental]'], "", %w(false), []) assert_in_out_err(%w(-W -e) + ['p Warning[:performance]'], "", %w(false), []) assert_in_out_err(%w(-W:performance -e) + ['p Warning[:performance]'], "", %w(true), []) - assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: `qux'/) + assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: 'qux'/) assert_in_out_err(%w(-w -e) + ['p Warning[:deprecated]'], "", %w(true), []) assert_in_out_err(%w(-W -e) + ['p Warning[:deprecated]'], "", %w(true), []) assert_in_out_err(%w(-We) + ['p Warning[:deprecated]'], "", %w(true), []) @@ -204,7 +204,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(--enable=all --disable=rjit -e) + [""], "", [], []) end assert_in_out_err(%w(--enable foobarbazqux -e) + [""], "", [], - /unknown argument for --enable: `foobarbazqux'/) + /unknown argument for --enable: 'foobarbazqux'/) assert_in_out_err(%w(--enable), "", [], /missing argument for --enable/) end @@ -213,7 +213,7 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(--disable-all -e) + [""], "", [], []) assert_in_out_err(%w(--disable=all -e) + [""], "", [], []) assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [], - /unknown argument for --disable: `foobarbazqux'/) + /unknown argument for --disable: 'foobarbazqux'/) assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/) assert_in_out_err(%w(-e) + ['p defined? Gem'], "", ["nil"], []) assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], []) @@ -443,7 +443,7 @@ class TestRubyOptions < Test::Unit::TestCase ENV['RUBYOPT'] = '-W:no-experimental' assert_in_out_err(%w(), "p Warning[:experimental]", ["false"]) ENV['RUBYOPT'] = '-W:qux' - assert_in_out_err(%w(), "", [], /unknown warning category: `qux'/) + assert_in_out_err(%w(), "", [], /unknown warning category: 'qux'/) ENV['RUBYOPT'] = 'w' assert_in_out_err(%w(), "p $VERBOSE", ["true"]) @@ -558,7 +558,7 @@ class TestRubyOptions < Test::Unit::TestCase t.puts " end" t.puts "end" t.flush - warning = ' warning: found `= literal\' in conditional, should be ==' + warning = ' warning: found \'= literal\' in conditional, should be ==' err = ["#{t.path}:1:#{warning}", "#{t.path}:4:#{warning}", ] @@ -820,8 +820,8 @@ class TestRubyOptions < Test::Unit::TestCase %r( (?: --\sRuby\slevel\sbacktrace\sinformation\s----------------------------------------\n - (?:-e:1:in\s\`(?:block\sin\s)?<main>\'\n)* - -e:1:in\s\`kill\'\n + (?:-e:1:in\s\'(?:block\sin\s)?<main>\'\n)* + -e:1:in\s\'kill\'\n \n )? )x, diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 6c17f279d4..2f96bc1172 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -1123,9 +1123,9 @@ CODE when :line assert_match(/ in /, str) when :call, :c_call - assert_match(/call \`/, str) # #<TracePoint:c_call `inherited' ../trunk/test.rb:11> + assert_match(/call \'/, str) # #<TracePoint:c_call 'inherited' ../trunk/test.rb:11> when :return, :c_return - assert_match(/return \`/, str) # #<TracePoint:return `m' ../trunk/test.rb:3> + assert_match(/return \'/, str) # #<TracePoint:return 'm' ../trunk/test.rb:3> when /thread/ assert_match(/\#<Thread:/, str) # #<TracePoint:thread_end of #<Thread:0x87076c0>> else diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index a3aa823cdc..1ea0d1763f 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -491,7 +491,7 @@ class TestSyntax < Test::Unit::TestCase def test_warn_balanced warning = <<WARN -test:1: warning: `%s' after local variable or literal is interpreted as binary operator +test:1: warning: '%s' after local variable or literal is interpreted as binary operator test:1: warning: even though it seems like %s WARN [ @@ -699,7 +699,7 @@ WARN end def test_duplicated_when - w = 'warning: duplicated `when\' clause with line 3 is ignored' + w = 'warning: duplicated \'when\' clause with line 3 is ignored' assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) { eval %q{ case 1 @@ -740,7 +740,7 @@ WARN end def test_duplicated_when_check_option - w = /duplicated `when\' clause with line 3 is ignored/ + w = /duplicated \'when\' clause with line 3 is ignored/ assert_in_out_err(%[-wc], "#{<<~"begin;"}\n#{<<~'end;'}", ["Syntax OK"], w) begin; case 1 @@ -1315,7 +1315,7 @@ eom end def test_parenthesised_statement_argument - assert_syntax_error("foo(bar rescue nil)", /unexpected `rescue' modifier/) + assert_syntax_error("foo(bar rescue nil)", /unexpected 'rescue' modifier/) assert_valid_syntax("foo (bar rescue nil)") end @@ -1803,7 +1803,7 @@ eom assert_syntax_error('def x(_4) end', /_4 is reserved for numbered parameter/) assert_syntax_error('def _5; end', /_5 is reserved for numbered parameter/) assert_syntax_error('def self._6; end', /_6 is reserved for numbered parameter/) - assert_raise_with_message(NameError, /undefined local variable or method `_1'/) { + assert_raise_with_message(NameError, /undefined local variable or method '_1'/) { eval('_1') } ['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c| @@ -1826,12 +1826,12 @@ eom def test_it assert_valid_syntax('proc {it}') - assert_syntax_error('[1,2].then {it+_2}', /`it` is already used/) + assert_syntax_error('[1,2].then {it+_2}', /'it' is already used/) assert_syntax_error('[1,2].then {_2+it}', /numbered parameter is already used/) assert_equal([1, 2], eval('[1,2].then {it}')) - assert_syntax_error('[1,2].then {"#{it}#{_2}"}', /`it` is already used/) + assert_syntax_error('[1,2].then {"#{it}#{_2}"}', /'it' is already used/) assert_syntax_error('[1,2].then {"#{_2}#{it}"}', /numbered parameter is already used/) - assert_syntax_error('->{it+_2}.call(1,2)', /`it` is already used/) + assert_syntax_error('->{it+_2}.call(1,2)', /'it' is already used/) assert_syntax_error('->{_2+it}.call(1,2)', /numbered parameter is already used/) assert_equal(4, eval('->(a=->{it}){a}.call.call(4)')) assert_equal(5, eval('-> a: ->{it} {a}.call.call(5)')) @@ -1857,7 +1857,7 @@ eom assert_equal(4, eval('a=Object.new; def a.foo(it); it; end; a.foo(4)')) assert_equal(5, eval('a=Object.new; def a.it; 5; end; a.it')) assert_equal(6, eval('a=Class.new; a.class_eval{ def it; 6; end }; a.new.it')) - assert_raise_with_message(NameError, /undefined local variable or method `it'/) do + assert_raise_with_message(NameError, /undefined local variable or method 'it'/) do eval('it') end ['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c| diff --git a/test/rubygems/test_rubygems.rb b/test/rubygems/test_rubygems.rb index 25211cb0e9..4f937ca6b8 100644 --- a/test/rubygems/test_rubygems.rb +++ b/test/rubygems/test_rubygems.rb @@ -17,7 +17,7 @@ class GemTest < Gem::TestCase output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { err: [:child, :out] }).strip assert !$?.success? - assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'" + assert_includes output, "undefined local variable or method 'intentionally_not_implemented_method'" assert_includes output, "Loading the #{operating_system_rb_at(path)} file caused an error. " \ "This file is owned by your OS, not by rubygems upstream. " \ "Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \ diff --git a/test/test_forwardable.rb b/test/test_forwardable.rb index deb0b5d5cf..9cbf8f7a20 100644 --- a/test/test_forwardable.rb +++ b/test/test_forwardable.rb @@ -306,7 +306,7 @@ class TestForwardable < Test::Unit::TestCase def test_basicobject_subclass bug11616 = '[ruby-core:71176] [Bug #11616]' - assert_raise_with_message(NameError, /`bar'/, bug11616) { + assert_raise_with_message(NameError, /'bar'/, bug11616) { Foo2.new.baz } end |