-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When limits defined by max_nesting or max_bytesize options are encountered, roundtrip operations fail. The problem is illustrated in the following script:
require 'lines'
require 'json'
require 'yaml'
class LinesRoundtrip
::DATA = {
large: { "foo" => "b#{'a'*2048}r" },
small: { "foo" => "bar" }
}
def run!
roundtrip DATA[:small], Lines
roundtrip DATA[:small], JSON
roundtrip DATA[:small], YAML
roundtrip DATA[:large], Lines
roundtrip DATA[:large], JSON
roundtrip DATA[:large], YAML
end
def roundtrip(data, serializer)
puts "Attempting to roundtrip using #{serializer.name}:"
puts " #{data.inspect}"
dump = serializer.dump(data)
load = serializer.load(dump)
puts "Ended up with:"
puts " #{load.inspect}"
puts "---"
end
end
begin
if $0 == __FILE__
LinesRoundtrip.new().run!
end
rescue Interrupt
# Ctrl^C
exit 130
rescue Errno::EPIPE
# STDOUT was closed
exit 74 # EX_IOERR
end
When that script is run, Lines fails to roundtrip the large value.
Metadata
Metadata
Assignees
Labels
No labels