diff options
| author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2025-02-25 16:37:58 +1300 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-02-25 03:38:04 +0000 |
| commit | 021ccbf7e8e34a1ae7af2d8411ed6dc4e5e8f980 (patch) | |
| tree | 49856e7bfd962fd521a76a5d256a750a09706336 /test | |
| parent | d32fa5283f1197f2dfbd1f22d06515035095ecee (diff) | |
[ruby/pp] Ensure the thread local state is always set up.
(https://github.com/ruby/pp/pull/38)
https://github.com/ruby/pp/commit/5b5d483ac2
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_pp.rb | 16 |
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 |
