diff options
author | Charles Oliver Nutter <headius@headius.com> | 2023-09-18 09:54:23 -0500 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-10-02 11:47:35 +0900 |
commit | 5c501bcbdb163f8e27d098e2149cf9840e1043ac (patch) | |
tree | de502d5295850dfb25f4213092ee9eb7c725de6d | |
parent | f208f78bdfc65341cb6547a378ff616b1928e48a (diff) | |
download | ruby-5c501bcbdb163f8e27d098e2149cf9840e1043ac.tar.gz |
[ruby/psych] Add test for code_point_limit
Only supported on JRuby currently.
https://github.com/ruby/psych/commit/0c1754eefe
-rw-r--r-- | test/psych/test_parser.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb index 3b67a8eab1..c1e0abb89d 100644 --- a/test/psych/test_parser.rb +++ b/test/psych/test_parser.rb @@ -384,6 +384,25 @@ module Psych [:end_stream, [2, 0, 2, 0]]], events end + if Psych::Parser.method_defined?(:code_point_limit) + def test_code_point_limit + yaml = "foo: bar\n" * 500_000 + assert_raise(org.snakeyaml.engine.v2.exceptions.YamlEngineException) do + Psych.load(yaml) + end + + assert_nothing_raised do + begin + old_code_point_limit, Psych::Parser.code_point_limit = Psych::Parser::code_point_limit, 5_000_000 + + Psych.load(yaml) + ensure + Psych::Parser.code_point_limit = old_code_point_limit + end + end + end + end + def assert_called call, with = nil, parser = @parser if with call = parser.handler.calls.find { |x| |