summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_pp.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_pp.rb b/test/test_pp.rb
index 2646846d8b..c71445c9bc 100644
--- a/test/test_pp.rb
+++ b/test/test_pp.rb
@@ -243,6 +243,22 @@ class PPSingleLineTest < Test::Unit::TestCase
assert_equal("[{}]", PP.singleline_pp([->(*a){a.last.clear}.ruby2_keywords.call(a: 1)], ''.dup))
assert_equal("[{}]", PP.singleline_pp([Hash.ruby2_keywords_hash({})], ''.dup))
end
+
+ def test_direct_pp
+ buffer = String.new
+
+ a = []
+ a << a
+
+ # Isolate the test from any existing Thread.current[:__recursive_key__][:inspect].
+ Thread.new do
+ q = PP::SingleLine.new(buffer)
+ q.pp(a)
+ q.flush
+ end.join
+
+ assert_equal("[[...]]", buffer)
+ end
end
class PPDelegateTest < Test::Unit::TestCase