Merge pull request #92 from trlim/master

Update integration tests
This commit is contained in:
Alex Crichton 2016-04-03 00:14:03 -07:00
commit b25592c238
30 changed files with 196 additions and 12 deletions

View file

@ -8,7 +8,7 @@
}, },
{ {
"type": "float", "type": "float",
"value": "1.0" "value": "1.1"
} }
] ]
} }

View file

@ -50,6 +50,20 @@ test!(float_no_leading_zero,
include_str!("invalid/float-no-leading-zero.toml")); include_str!("invalid/float-no-leading-zero.toml"));
test!(float_no_trailing_digits, test!(float_no_trailing_digits,
include_str!("invalid/float-no-trailing-digits.toml")); include_str!("invalid/float-no-trailing-digits.toml"));
test!(key_empty,
include_str!("invalid/key-empty.toml"));
test!(key_hash,
include_str!("invalid/key-hash.toml"));
test!(key_newline,
include_str!("invalid/key-newline.toml"));
test!(key_open_bracket,
include_str!("invalid/key-open-bracket.toml"));
test!(key_single_open_bracket,
include_str!("invalid/key-single-open-bracket.toml"));
test!(key_space,
include_str!("invalid/key-space.toml"));
test!(key_start_bracket,
include_str!("invalid/key-start-bracket.toml"));
test!(key_two_equals, test!(key_two_equals,
include_str!("invalid/key-two-equals.toml")); include_str!("invalid/key-two-equals.toml"));
test!(string_bad_byte_escape, test!(string_bad_byte_escape,
@ -66,10 +80,16 @@ test!(table_array_malformed_bracket,
include_str!("invalid/table-array-malformed-bracket.toml")); include_str!("invalid/table-array-malformed-bracket.toml"));
test!(table_array_malformed_empty, test!(table_array_malformed_empty,
include_str!("invalid/table-array-malformed-empty.toml")); include_str!("invalid/table-array-malformed-empty.toml"));
test!(table_empty,
include_str!("invalid/table-empty.toml"));
test!(table_nested_brackets_close, test!(table_nested_brackets_close,
include_str!("invalid/table-nested-brackets-close.toml")); include_str!("invalid/table-nested-brackets-close.toml"));
test!(table_nested_brackets_open, test!(table_nested_brackets_open,
include_str!("invalid/table-nested-brackets-open.toml")); include_str!("invalid/table-nested-brackets-open.toml"));
test!(table_whitespace,
include_str!("invalid/table-whitespace.toml"));
test!(table_with_pound,
include_str!("invalid/table-with-pound.toml"));
test!(text_after_array_entries, test!(text_after_array_entries,
include_str!("invalid/text-after-array-entries.toml")); include_str!("invalid/text-after-array-entries.toml"));
test!(text_after_integer, test!(text_after_integer,

View file

@ -1 +1 @@
ints-and-floats = [1, 1.0] ints-and-floats = [1, 1.1]

View file

@ -0,0 +1 @@
= 1

View file

@ -0,0 +1 @@
a# = 1

View file

@ -0,0 +1,2 @@
a
= 1

View file

@ -0,0 +1 @@
[abc = 1

View file

@ -0,0 +1 @@
[

View file

@ -0,0 +1 @@
a b = 1

View file

@ -0,0 +1,3 @@
[a]
[xyz = 5
[b]

View file

@ -0,0 +1 @@
[]

View file

@ -0,0 +1 @@
[invalid key]

View file

@ -0,0 +1,2 @@
[key#group]
answer = 42

View file

@ -112,6 +112,9 @@ test!(integer,
test!(key_equals_nospace, test!(key_equals_nospace,
include_str!("valid/key-equals-nospace.toml"), include_str!("valid/key-equals-nospace.toml"),
include_str!("valid/key-equals-nospace.json")); include_str!("valid/key-equals-nospace.json"));
test!(key_space,
include_str!("valid/key-space.toml"),
include_str!("valid/key-space.json"));
test!(key_special_chars, test!(key_special_chars,
include_str!("valid/key-special-chars.toml"), include_str!("valid/key-special-chars.toml"),
include_str!("valid/key-special-chars.json")); include_str!("valid/key-special-chars.json"));
@ -124,6 +127,15 @@ test!(long_float,
test!(long_integer, test!(long_integer,
include_str!("valid/long-integer.toml"), include_str!("valid/long-integer.toml"),
include_str!("valid/long-integer.json")); include_str!("valid/long-integer.json"));
test!(multiline_string,
include_str!("valid/multiline-string.toml"),
include_str!("valid/multiline-string.json"));
test!(raw_multiline_string,
include_str!("valid/raw-multiline-string.toml"),
include_str!("valid/raw-multiline-string.json"));
test!(raw_string,
include_str!("valid/raw-string.toml"),
include_str!("valid/raw-string.json"));
test!(string_empty, test!(string_empty,
include_str!("valid/string-empty.toml"), include_str!("valid/string-empty.toml"),
include_str!("valid/string-empty.json")); include_str!("valid/string-empty.json"));

View file

@ -11,8 +11,8 @@
{"type": "string", "value": "b"} {"type": "string", "value": "b"}
]}, ]},
{"type": "array", "value": [ {"type": "array", "value": [
{"type": "float", "value": "1.0"}, {"type": "float", "value": "1.1"},
{"type": "float", "value": "2.0"} {"type": "float", "value": "2.1"}
]} ]}
] ]
} }

View file

@ -1 +1 @@
mixed = [[1, 2], ["a", "b"], [1.0, 2.0]] mixed = [[1, 2], ["a", "b"], [1.1, 2.1]]

View file

@ -10,9 +10,9 @@
"floats": { "floats": {
"type": "array", "type": "array",
"value": [ "value": [
{"type": "float", "value": "1.0"}, {"type": "float", "value": "1.1"},
{"type": "float", "value": "2.0"}, {"type": "float", "value": "2.1"},
{"type": "float", "value": "3.0"} {"type": "float", "value": "3.1"}
] ]
}, },
"strings": { "strings": {

View file

@ -1,9 +1,8 @@
ints = [1, 2, 3] ints = [1, 2, 3]
floats = [1.0, 2.0, 3.0] floats = [1.1, 2.1, 3.1]
strings = ["a", "b", "c"] strings = ["a", "b", "c"]
dates = [ dates = [
1987-07-05T17:45:00Z, 1987-07-05T17:45:00Z,
1979-05-27T07:32:00Z, 1979-05-27T07:32:00Z,
2006-06-01T11:00:00Z, 2006-06-01T11:00:00Z,
] ]

View file

@ -0,0 +1,3 @@
{
"a b": {"type": "integer", "value": "1"}
}

View file

@ -0,0 +1 @@
"a b" = 1

View file

@ -0,0 +1,30 @@
{
"multiline_empty_one": {
"type": "string",
"value": ""
},
"multiline_empty_two": {
"type": "string",
"value": ""
},
"multiline_empty_three": {
"type": "string",
"value": ""
},
"multiline_empty_four": {
"type": "string",
"value": ""
},
"equivalent_one": {
"type": "string",
"value": "The quick brown fox jumps over the lazy dog."
},
"equivalent_two": {
"type": "string",
"value": "The quick brown fox jumps over the lazy dog."
},
"equivalent_three": {
"type": "string",
"value": "The quick brown fox jumps over the lazy dog."
}
}

View file

@ -0,0 +1,23 @@
multiline_empty_one = """"""
multiline_empty_two = """
"""
multiline_empty_three = """\
"""
multiline_empty_four = """\
\
\
"""
equivalent_one = "The quick brown fox jumps over the lazy dog."
equivalent_two = """
The quick brown \
fox jumps over \
the lazy dog."""
equivalent_three = """\
The quick brown \
fox jumps over \
the lazy dog.\
"""

View file

@ -0,0 +1,14 @@
{
"oneline": {
"type": "string",
"value": "This string has a ' quote character."
},
"firstnl": {
"type": "string",
"value": "This string has a ' quote character."
},
"multiline": {
"type": "string",
"value": "This string\nhas ' a quote character\nand more than\none newline\nin it."
}
}

View file

@ -0,0 +1,9 @@
oneline = '''This string has a ' quote character.'''
firstnl = '''
This string has a ' quote character.'''
multiline = '''
This string
has ' a quote character
and more than
one newline
in it.'''

View file

@ -0,0 +1,30 @@
{
"backspace": {
"type": "string",
"value": "This string has a \\b backspace character."
},
"tab": {
"type": "string",
"value": "This string has a \\t tab character."
},
"newline": {
"type": "string",
"value": "This string has a \\n new line character."
},
"formfeed": {
"type": "string",
"value": "This string has a \\f form feed character."
},
"carriage": {
"type": "string",
"value": "This string has a \\r carriage return character."
},
"slash": {
"type": "string",
"value": "This string has a \\/ slash character."
},
"backslash": {
"type": "string",
"value": "This string has a \\\\ backslash character."
}
}

View file

@ -0,0 +1,7 @@
backspace = 'This string has a \b backspace character.'
tab = 'This string has a \t tab character.'
newline = 'This string has a \n new line character.'
formfeed = 'This string has a \f form feed character.'
carriage = 'This string has a \r carriage return character.'
slash = 'This string has a \/ slash character.'
backslash = 'This string has a \\ backslash character.'

View file

@ -30,5 +30,21 @@
"backslash": { "backslash": {
"type": "string", "type": "string",
"value": "This string has a \u005C backslash character." "value": "This string has a \u005C backslash character."
},
"notunicode1": {
"type": "string",
"value": "This string does not have a unicode \\u escape."
},
"notunicode2": {
"type": "string",
"value": "This string does not have a unicode \u005Cu escape."
},
"notunicode3": {
"type": "string",
"value": "This string does not have a unicode \\u0075 escape."
},
"notunicode4": {
"type": "string",
"value": "This string does not have a unicode \\\u0075 escape."
} }
} }

View file

@ -6,3 +6,7 @@ carriage = "This string has a \r carriage return character."
quote = "This string has a \" quote character." quote = "This string has a \" quote character."
slash = "This string has a / slash character." slash = "This string has a / slash character."
backslash = "This string has a \\ backslash character." backslash = "This string has a \\ backslash character."
notunicode1 = "This string does not have a unicode \\u escape."
notunicode2 = "This string does not have a unicode \u005Cu escape."
notunicode3 = "This string does not have a unicode \\u0075 escape."
notunicode4 = "This string does not have a unicode \\\u0075 escape."

View file

@ -1,3 +1,4 @@
{ {
"answer": {"type": "string", "value": "\u03B4"} "answer4": {"type": "string", "value": "\u03B4"},
"answer8": {"type": "string", "value": "\u03B4"}
} }

View file

@ -1 +1,2 @@
answer = "\u03B4" answer4 = "\u03B4"
answer8 = "\U000003B4"