-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add quotes for all values listed in https://yaml.org/type/bool.html
- Loading branch information
1 parent
55ff3c8
commit 45101fb
Showing
2 changed files
with
69 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
35 changes: 35 additions & 0 deletions
35
yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/misc/ReservedValuesTest.java
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,35 @@ | ||
package com.fasterxml.jackson.dataformat.yaml.misc; | ||
|
||
import java.util.*; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase; | ||
|
||
public class ReservedValuesTest extends ModuleTestBase | ||
{ | ||
private final ObjectMapper MAPPER = newObjectMapper(); | ||
|
||
public void testQuotingOfBooleanValues() throws Exception | ||
{ | ||
for (String value : new String[] { | ||
"null", "Null", "NULL", | ||
"true", "True", "TRUE", | ||
"false", "False", "FALSE", | ||
"yes", "Yes", "YES", | ||
"no" "No", "NO", | ||
"y", "Y", "n", "N", | ||
"on", "On", "ON", | ||
"off" "Off", "OFF" | ||
}) { | ||
_testQuotingOfBooleanValues(value); | ||
} | ||
} | ||
|
||
private void _testQuotingOfBooleanValues(String value) throws Exception | ||
{ | ||
final Map<String, Integer> input = Collections.singletonMap("key", value); | ||
final String doc = trimDocMarker(MAPPER.writeValueAsString(input).trim()); | ||
|
||
assertEquals("key: \""+value+"\"", doc); | ||
} | ||
} |