-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output document end marker after open ended scalars #162
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdfadff
to
2bb1265
Compare
2bb1265
to
cc0d439
Compare
I updated the several testsuite branches and removed the two tests from the blacklist, basically with the same procedure as in #172 |
perlpunk
added a commit
that referenced
this pull request
Apr 17, 2020
open_ended can have two states: 1: The previous document wasn't ended with ... 2: the last scalar event was a block scalar with trailing empty lines |+ This was broken in the past, and fixed in fa1293a. With my last PR #162 I added the faulty behaviour again. The problematic behaviour showed only when: * writing YAML directives * writing unquoted top level scalars * writing more than one document ================== BROKEN ============================== The first example shows that the document end marker is not emitted before the next document. This would be valid in YAML 1.1 if the scalar was quoted, but not if it is plain. This commit fixes this. echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo %YAML 1.1 --- bar ================== FIXED ============================== echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ======================================================= Other examples which should look like this (and were correct already before this fix): Open ended scalars like |+ need '...' at the end of the stream: echo '--- |+ a --- |+ a ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --- |+ a --- |+ a ... ======================================================= If a document is ended with an explicit '...', the code should not print '...' twice: echo '--- foo ... --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ==========================================================
perlpunk
added a commit
that referenced
this pull request
Apr 19, 2020
open_ended can have three states now: 0: The previous document was ended explicitly with '...' 1: The previous document wasn't ended with '...' 2: The last scalar event was a block scalar with trailing empty lines |+, and last document wasn't ended with '...'. Important at stream end. This was broken in the past, and fixed in fa1293a. With my last PR #162 I added the faulty behaviour again. The problematic behaviour showed only when all of the following conditions were true: * writing YAML directives * writing unquoted top level scalars * writing more than one document ================== BROKEN ============================== The first example shows that the document end marker is not emitted before the next document. This would be valid in YAML 1.1 if the scalar was quoted, but not if it is plain. This commit fixes this. echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo %YAML 1.1 --- bar ================== FIXED ============================== echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ======================================================= Other examples which should look like this (and were correct already before this fix): Open ended scalars like |+ need '...' at the end of the stream: echo '--- |+ a --- |+ a ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --- |+ a --- |+ a ... ======================================================= If a document is ended with an explicit '...', the code should not print '...' twice: echo '--- foo ... --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ==========================================================
perlpunk
added a commit
that referenced
this pull request
Apr 19, 2020
open_ended can have three states now: 0: The previous document was ended explicitly with '...' 1: The previous document wasn't ended with '...' 2: The last scalar event was a block scalar with trailing empty lines |+, and last document wasn't ended with '...'. Important at stream end. This was broken in the past, and fixed in fa1293a. With my last PR #162 I added the faulty behaviour again. The problematic behaviour showed only when all of the following conditions were true: * writing YAML directives * writing unquoted top level scalars * writing more than one document ================== BROKEN ============================== The first example shows that the document end marker is not emitted before the next document. This would be valid in YAML 1.1 if the scalar was quoted, but not if it is plain. This commit fixes this. echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo %YAML 1.1 --- bar ================== FIXED ============================== echo '--- foo --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ======================================================= Other examples which should look like this (and were correct already before this fix): Open ended scalars like |+ need '...' at the end of the stream: echo '--- |+ a --- |+ a ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --- |+ a --- |+ a ... ======================================================= If a document is ended with an explicit '...', the code should not print '...' twice: echo '--- foo ... --- bar ' | ./tests/run-parser-test-suite | ./tests/run-emitter-test-suite --directive 1.1 %YAML 1.1 --- foo ... %YAML 1.1 --- bar ==========================================================
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See also #123
Depends on: #160
This will output
...
at the end of the YAML Stream if the previous scalar is open ended, e.g. a block scalar|+
with trailing empty lines.Tests passing:
blacklist/libyaml-emitter
Unfortunately there is no possibility to edit the list of skipped tests in this PR, so I have to keep this in mind and adjust the skiplist later.