summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorIchito Nagata <[email protected]>2018-06-04 10:52:51 +0900
committerIchito Nagata <[email protected]>2018-06-04 11:25:10 +0900
commit2af92d0ebcbeca6d3d85a27c8193273080a63090 (patch)
tree51213df1520495df867610f6a84e5d47547bc1bb /test
parent395260747add350d55eab002c183e7028605dbc8 (diff)
downloadmruby-2af92d0ebcbeca6d3d85a27c8193273080a63090.tar.gz
mruby-2af92d0ebcbeca6d3d85a27c8193273080a63090.zip
Let inspect recursion do the right thing
Diffstat (limited to 'test')
-rw-r--r--test/t/array.rb3
-rw-r--r--test/t/hash.rb2
2 files changed, 4 insertions, 1 deletions
diff --git a/test/t/array.rb b/test/t/array.rb
index ecec39363..3ed3d54ec 100644
--- a/test/t/array.rb
+++ b/test/t/array.rb
@@ -318,11 +318,12 @@ end
assert('Array#to_s', '15.2.12.5.31 / 15.2.12.5.32') do
a = [2, 3, 4, 5]
+ a[4] = a
r1 = a.to_s
r2 = a.inspect
assert_equal(r2, r1)
- assert_equal("[2, 3, 4, 5]", r1)
+ assert_equal("[2, 3, 4, 5, [...]]", r1)
end
assert('Array#==', '15.2.12.5.33') do
diff --git a/test/t/hash.rb b/test/t/hash.rb
index 5403a5901..63029be42 100644
--- a/test/t/hash.rb
+++ b/test/t/hash.rb
@@ -351,11 +351,13 @@ end
assert('Hash#inspect') do
h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
+ h["recur"] = h
ret = h.to_s
assert_include ret, '"c"=>300'
assert_include ret, '"a"=>100'
assert_include ret, '"d"=>400'
+ assert_include ret, '"recur"=>{...}'
end
assert('Hash#rehash') do