-
Notifications
You must be signed in to change notification settings - Fork 210
Description
In https://bitbucket.org/asomov/snakeyaml/pull-requests/7 SnakeYAML added features to support parsing and emitting comments. Unfortunately this has had a side effect of deferring some emits, and there does not appear to be a way to turn it off.
An example from jruby/jruby#6680 shows how this is failing:
def test_float
@stream.push 1.2
assert_match(/^--- 1.2/, @io.string)
end 2) Failure:
Psych::JSON::TestStream#test_float [/home/travis/build/jruby/jruby/test/mri/psych/json/test_stream.rb:50]:
Expected /^--- 1.2/ to match "".
The issue here is that since the stream is never finished and SnakeYAML is waiting for a comment, the emit of the float scalar never happens. Modifying the code to do @stream.finishafter the push allows this and all similar tests to pass.
So the question is: should the tests or SnakeYAML be modified?
Basically I need to understand whether this deferred emit constitutes a significant-enough break from libyaml to warrant a fix to SnakeYAML, or if the tests are unreasonable in expecting all events to be emitted immediately.
Any input from other Psych maintainers?