The parser does not allow spaces in the key
foo bar: value
is considered invalid. I have updated PlainYamlParser to allow spaces.
allow spaces
Here's a test for the Validator:
public void testMappingWithStringInKey() throws Exception { _schema = "" + "type: map\n" + "mapping:\n" + " 'foo bar':\n" + " type: str\n"; _valid = "'foo bar': value"; _invalid = "foobar: value"; _error = ":key_undefined : (line 1)[/foobar] key 'foobar:' is undefined.\n"; doTest();
_valid = "foo bar: value"; doTest(); }
and here's a test for the parser:
public void testSpacesWorkInKeys() throws Exception { _input = "foo bar: value"; _expected = "{\"foo bar\"=>\"value\"}"; doTest(); }
Log in to post a comment.
allow spaces
Here's a test for the Validator:
public void testMappingWithStringInKey() throws Exception {
_schema = "" +
"type: map\n" +
"mapping:\n" +
" 'foo bar':\n" +
" type: str\n";
_valid = "'foo bar': value";
_invalid = "foobar: value";
_error = ":key_undefined : (line 1)[/foobar] key 'foobar:' is undefined.\n";
doTest();
_valid = "foo bar: value";
doTest();
}
and here's a test for the parser:
public void testSpacesWorkInKeys() throws Exception {
_input = "foo bar: value";
_expected = "{\"foo bar\"=>\"value\"}";
doTest();
}