summaryrefslogtreecommitdiff
path: root/test/psych/test_parser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/test_parser.rb')
-rw-r--r--test/psych/test_parser.rb19
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|