-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix read of sequence starting at dash
- Loading branch information
1 parent
34b4679
commit 640404a
Showing
4 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ | |
* @author Mihai Andronache ([email protected]) | ||
* @version $Id$ | ||
* @since 1.0.1 | ||
* @checkstyle ExecutableStatementCount (2000 lines) | ||
* @checkstyle ExecutableStatementCount (3000 lines) | ||
*/ | ||
public final class RtYamlInputTest { | ||
|
||
|
@@ -889,6 +889,47 @@ public void shouldReadSequenceWhenFirstKeyIsOnTheSameLineFourthCase() | |
); | ||
} | ||
|
||
/** | ||
* Corner case when key:value is on the same with sequence marker. | ||
* <a href="https://github.com/decorators-squad/eo-yaml/issues/447">#447</a> | ||
* and based on | ||
* <a href="https://github.com/decorators-squad/eo-yaml/pull/416">PR</a> | ||
* @throws IOException If something is wrong. | ||
*/ | ||
@Test | ||
public void shouldReadSequenceWhenFirstNodeIsOnTheSameLine() | ||
throws IOException { | ||
final String fileName = "src/test/resources/issue_447_bug_mapping" | ||
+ "_case_5.yml"; | ||
final YamlMapping root = Yaml.createYamlInput(new File(fileName)) | ||
.readYamlMapping(); | ||
MatcherAssert.assertThat( | ||
root, | ||
Matchers.equalTo( | ||
Yaml.createYamlMappingBuilder() | ||
.add("key", "value") | ||
.add("seqMap", Yaml.createYamlSequenceBuilder() | ||
.add(Yaml.createYamlMappingBuilder() | ||
.add("alfa", "b") | ||
.build()) | ||
.add(Yaml.createYamlMappingBuilder() | ||
.add("this", | ||
Yaml.createYamlSequenceBuilder().add( | ||
Yaml.createYamlSequenceBuilder() | ||
.add("sequence") | ||
.add("starting") | ||
.add("at") | ||
.add("dash") | ||
.build() | ||
).build()) | ||
.build()) | ||
.build()) | ||
.add("key2", "value") | ||
.build() | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Corner case when key:value is on the same line as the sequence marker | ||
* and key contains dashes (which is the sequence marker itself). | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
key: value | ||
seqMap: | ||
- alfa: b | ||
- this: | ||
- - sequence | ||
- starting | ||
- at | ||
- dash | ||
key2: value |