summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authortompng <[email protected]>2024-06-08 00:23:12 +0900
committerYusuke Endoh <[email protected]>2024-10-03 18:47:09 +0900
commit7237af75d2aa700454fbaba9bda7a9283413d903 (patch)
tree9a3d57943a0d60786dc93f5b2ed6e24ea8c9e757 /test/ruby
parentf4e548924e36c9b1d19551a943881cb57bb41471 (diff)
Update ruby test for colon-style hash inspect
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/10924
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb2
-rw-r--r--test/ruby/test_exception.rb4
-rw-r--r--test/ruby/test_hash.rb4
-rw-r--r--test/ruby/test_keyword.rb2
-rw-r--r--test/ruby/test_pattern_matching.rb10
-rw-r--r--test/ruby/test_sprintf.rb2
6 files changed, 12 insertions, 12 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 91f4250cfc..edfc25c43d 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -803,7 +803,7 @@ dummy
"puts RubyVM::AbstractSyntaxTree.of(->{ 1 + 2 }, keep_script_lines: true).script_lines",
"p SCRIPT_LINES__"
]
- test_stdout = lines + ['{"-e"=>[]}']
+ test_stdout = lines + ['{"-e" => []}']
assert_in_out_err(["-e", lines.join("\n")], "", test_stdout, [])
end
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 09df1b5dcb..84581180b6 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1128,11 +1128,11 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
assert_raise(ArgumentError) {warn("test warning", uplevel: -1)}
assert_in_out_err(["-e", "warn 'ok', uplevel: 1"], '', [], /warning:/)
warning = capture_warning_warn {warn("test warning", {uplevel: 0})}
- assert_match(/test warning.*{:uplevel=>0}/m, warning[0])
+ assert_match(/test warning.*{uplevel: 0}/m, warning[0])
warning = capture_warning_warn {warn("test warning", **{uplevel: 0})}
assert_equal("#{__FILE__}:#{__LINE__-1}: warning: test warning\n", warning[0])
warning = capture_warning_warn {warn("test warning", {uplevel: 0}, **{})}
- assert_equal("test warning\n{:uplevel=>0}\n", warning[0])
+ assert_equal("test warning\n{uplevel: 0}\n", warning[0])
assert_raise(ArgumentError) {warn("test warning", foo: 1)}
end
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 8219abc678..9578e71f00 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -2295,7 +2295,7 @@ class TestHashOnly < Test::Unit::TestCase
h = obj.h
h[obj] = true
- assert_equal '{0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9, test=>true}', h.inspect
+ assert_equal '{0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, test => true}', h.inspect
end
def test_ar2st_delete
@@ -2309,7 +2309,7 @@ class TestHashOnly < Test::Unit::TestCase
h[obj2] = true
h.delete obj
- assert_equal '{0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5, 6=>6, 7=>7, 8=>8, 9=>9}', h.inspect
+ assert_equal '{0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9}', h.inspect
end
def test_ar2st_lookup
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index a214acc232..6da1b73c15 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -2863,7 +2863,7 @@ class TestKeywordArguments < Test::Unit::TestCase
end
def test_top_ruby2_keywords
- assert_in_out_err([], <<-INPUT, ["[1, 2, 3]", "{:k=>1}"], [])
+ assert_in_out_err([], <<-INPUT, ["[1, 2, 3]", "{k: 1}"], [])
def bar(*a, **kw)
p a, kw
end
diff --git a/test/ruby/test_pattern_matching.rb b/test/ruby/test_pattern_matching.rb
index cfe3bd1e19..92a3244fc2 100644
--- a/test/ruby/test_pattern_matching.rb
+++ b/test/ruby/test_pattern_matching.rb
@@ -1664,7 +1664,7 @@ END
raise a # suppress "unused variable: a" warning
end
- assert_raise_with_message(NoMatchingPatternKeyError, "{:a=>0}: key not found: :aa") do
+ assert_raise_with_message(NoMatchingPatternKeyError, "{a: 0}: key not found: :aa") do
{a: 0} => {aa:}
raise aa # suppress "unused variable: aa" warning
rescue NoMatchingPatternKeyError => e
@@ -1673,7 +1673,7 @@ END
raise e
end
- assert_raise_with_message(NoMatchingPatternKeyError, "{:a=>{:b=>0}}: key not found: :bb") do
+ assert_raise_with_message(NoMatchingPatternKeyError, "{a: {b: 0}}: key not found: :bb") do
{a: {b: 0}} => {a: {bb:}}
raise bb # suppress "unused variable: bb" warning
rescue NoMatchingPatternKeyError => e
@@ -1682,15 +1682,15 @@ END
raise e
end
- assert_raise_with_message(NoMatchingPatternError, "{:a=>0}: 1 === 0 does not return true") do
+ assert_raise_with_message(NoMatchingPatternError, "{a: 0}: 1 === 0 does not return true") do
{a: 0} => {a: 1}
end
- assert_raise_with_message(NoMatchingPatternError, "{:a=>0}: {:a=>0} is not empty") do
+ assert_raise_with_message(NoMatchingPatternError, "{a: 0}: {a: 0} is not empty") do
{a: 0} => {}
end
- assert_raise_with_message(NoMatchingPatternError, "[{:a=>0}]: rest of {:a=>0} is not empty") do
+ assert_raise_with_message(NoMatchingPatternError, "[{a: 0}]: rest of {a: 0} is not empty") do
[{a: 0}] => [{**nil}]
end
end
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 8cf2c63a20..498f93aec4 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -235,7 +235,7 @@ class TestSprintf < Test::Unit::TestCase
def test_hash
options = {:capture=>/\d+/}
- assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options))
+ assert_equal("with options #{options.inspect}", sprintf("with options %p" % options))
end
def test_inspect