diff options
author | Alex Crichton <alex@alexcrichton.com> | 2016-04-03 00:14:03 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2016-04-03 00:14:03 -0700 |
commit | b25592c2386f415cbe34c1c08defce6f452e66ff (patch) | |
tree | 3a39c16c6b29780d77cd153d04d21e3ab3f1797a /tests | |
parent | c53fceb42c6600983021e5fa7dca9976c36590f4 (diff) | |
parent | 8a207a83fe21da6e498697b9a0ec81932f5208e6 (diff) | |
download | milf-rs-b25592c2386f415cbe34c1c08defce6f452e66ff.tar.gz milf-rs-b25592c2386f415cbe34c1c08defce6f452e66ff.zip |
Merge pull request #92 from trlim/master
Update integration tests
Diffstat (limited to 'tests')
30 files changed, 196 insertions, 12 deletions
diff --git a/tests/invalid-encoder/array-mixed-types-ints-and-floats.json b/tests/invalid-encoder/array-mixed-types-ints-and-floats.json index b7920a0..2d42ead 100644 --- a/tests/invalid-encoder/array-mixed-types-ints-and-floats.json +++ b/tests/invalid-encoder/array-mixed-types-ints-and-floats.json @@ -8,7 +8,7 @@ }, { "type": "float", - "value": "1.0" + "value": "1.1" } ] } diff --git a/tests/invalid.rs b/tests/invalid.rs index e9a94e9..829e795 100644 --- a/tests/invalid.rs +++ b/tests/invalid.rs @@ -50,6 +50,20 @@ test!(float_no_leading_zero, include_str!("invalid/float-no-leading-zero.toml")); test!(float_no_trailing_digits, 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, include_str!("invalid/key-two-equals.toml")); test!(string_bad_byte_escape, @@ -66,10 +80,16 @@ test!(table_array_malformed_bracket, include_str!("invalid/table-array-malformed-bracket.toml")); test!(table_array_malformed_empty, include_str!("invalid/table-array-malformed-empty.toml")); +test!(table_empty, + include_str!("invalid/table-empty.toml")); test!(table_nested_brackets_close, include_str!("invalid/table-nested-brackets-close.toml")); test!(table_nested_brackets_open, 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, include_str!("invalid/text-after-array-entries.toml")); test!(text_after_integer, diff --git a/tests/invalid/array-mixed-types-ints-and-floats.toml b/tests/invalid/array-mixed-types-ints-and-floats.toml index 51ebe80..a5aa9b7 100644 --- a/tests/invalid/array-mixed-types-ints-and-floats.toml +++ b/tests/invalid/array-mixed-types-ints-and-floats.toml @@ -1 +1 @@ -ints-and-floats = [1, 1.0] +ints-and-floats = [1, 1.1] diff --git a/tests/invalid/key-empty.toml b/tests/invalid/key-empty.toml new file mode 100644 index 0000000..09f998f --- /dev/null +++ b/tests/invalid/key-empty.toml @@ -0,0 +1 @@ + = 1 diff --git a/tests/invalid/key-hash.toml b/tests/invalid/key-hash.toml new file mode 100644 index 0000000..e321b1f --- /dev/null +++ b/tests/invalid/key-hash.toml @@ -0,0 +1 @@ +a# = 1 diff --git a/tests/invalid/key-newline.toml b/tests/invalid/key-newline.toml new file mode 100644 index 0000000..707aad5 --- /dev/null +++ b/tests/invalid/key-newline.toml @@ -0,0 +1,2 @@ +a += 1 diff --git a/tests/invalid/key-open-bracket.toml b/tests/invalid/key-open-bracket.toml new file mode 100644 index 0000000..f0aeb16 --- /dev/null +++ b/tests/invalid/key-open-bracket.toml @@ -0,0 +1 @@ +[abc = 1 diff --git a/tests/invalid/key-single-open-bracket.toml b/tests/invalid/key-single-open-bracket.toml new file mode 100644 index 0000000..8e2f0be --- /dev/null +++ b/tests/invalid/key-single-open-bracket.toml @@ -0,0 +1 @@ +[
\ No newline at end of file diff --git a/tests/invalid/key-space.toml b/tests/invalid/key-space.toml new file mode 100644 index 0000000..201806d --- /dev/null +++ b/tests/invalid/key-space.toml @@ -0,0 +1 @@ +a b = 1
\ No newline at end of file diff --git a/tests/invalid/key-start-bracket.toml b/tests/invalid/key-start-bracket.toml new file mode 100644 index 0000000..e0597ae --- /dev/null +++ b/tests/invalid/key-start-bracket.toml @@ -0,0 +1,3 @@ +[a] +[xyz = 5 +[b] diff --git a/tests/invalid/table-empty.toml b/tests/invalid/table-empty.toml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/tests/invalid/table-empty.toml @@ -0,0 +1 @@ +[] diff --git a/tests/invalid/table-whitespace.toml b/tests/invalid/table-whitespace.toml new file mode 100644 index 0000000..79bbcb1 --- /dev/null +++ b/tests/invalid/table-whitespace.toml @@ -0,0 +1 @@ +[invalid key]
\ No newline at end of file diff --git a/tests/invalid/table-with-pound.toml b/tests/invalid/table-with-pound.toml new file mode 100644 index 0000000..0d8edb5 --- /dev/null +++ b/tests/invalid/table-with-pound.toml @@ -0,0 +1,2 @@ +[key#group] +answer = 42
\ No newline at end of file diff --git a/tests/valid.rs b/tests/valid.rs index f346781..09589c9 100644 --- a/tests/valid.rs +++ b/tests/valid.rs @@ -112,6 +112,9 @@ test!(integer, test!(key_equals_nospace, include_str!("valid/key-equals-nospace.toml"), 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, include_str!("valid/key-special-chars.toml"), include_str!("valid/key-special-chars.json")); @@ -124,6 +127,15 @@ test!(long_float, test!(long_integer, include_str!("valid/long-integer.toml"), 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, include_str!("valid/string-empty.toml"), include_str!("valid/string-empty.json")); diff --git a/tests/valid/arrays-hetergeneous.json b/tests/valid/arrays-hetergeneous.json index e703739..478fa5c 100644 --- a/tests/valid/arrays-hetergeneous.json +++ b/tests/valid/arrays-hetergeneous.json @@ -11,8 +11,8 @@ {"type": "string", "value": "b"} ]}, {"type": "array", "value": [ - {"type": "float", "value": "1.0"}, - {"type": "float", "value": "2.0"} + {"type": "float", "value": "1.1"}, + {"type": "float", "value": "2.1"} ]} ] } diff --git a/tests/valid/arrays-hetergeneous.toml b/tests/valid/arrays-hetergeneous.toml index 91fcbdf..a246fcf 100644 --- a/tests/valid/arrays-hetergeneous.toml +++ b/tests/valid/arrays-hetergeneous.toml @@ -1 +1 @@ -mixed = [[1, 2], ["a", "b"], [1.0, 2.0]] +mixed = [[1, 2], ["a", "b"], [1.1, 2.1]] diff --git a/tests/valid/arrays.json b/tests/valid/arrays.json index 4d16d8a..58aedbc 100644 --- a/tests/valid/arrays.json +++ b/tests/valid/arrays.json @@ -10,9 +10,9 @@ "floats": { "type": "array", "value": [ - {"type": "float", "value": "1.0"}, - {"type": "float", "value": "2.0"}, - {"type": "float", "value": "3.0"} + {"type": "float", "value": "1.1"}, + {"type": "float", "value": "2.1"}, + {"type": "float", "value": "3.1"} ] }, "strings": { diff --git a/tests/valid/arrays.toml b/tests/valid/arrays.toml index 6d6440d..c435f57 100644 --- a/tests/valid/arrays.toml +++ b/tests/valid/arrays.toml @@ -1,9 +1,8 @@ ints = [1, 2, 3] -floats = [1.0, 2.0, 3.0] +floats = [1.1, 2.1, 3.1] strings = ["a", "b", "c"] dates = [ 1987-07-05T17:45:00Z, 1979-05-27T07:32:00Z, 2006-06-01T11:00:00Z, ] - diff --git a/tests/valid/key-space.json b/tests/valid/key-space.json new file mode 100644 index 0000000..9d1f769 --- /dev/null +++ b/tests/valid/key-space.json @@ -0,0 +1,3 @@ +{ + "a b": {"type": "integer", "value": "1"} +} diff --git a/tests/valid/key-space.toml b/tests/valid/key-space.toml new file mode 100644 index 0000000..f4f36c4 --- /dev/null +++ b/tests/valid/key-space.toml @@ -0,0 +1 @@ +"a b" = 1 diff --git a/tests/valid/multiline-string.json b/tests/valid/multiline-string.json new file mode 100644 index 0000000..075bf50 --- /dev/null +++ b/tests/valid/multiline-string.json @@ -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." + } +} diff --git a/tests/valid/multiline-string.toml b/tests/valid/multiline-string.toml new file mode 100644 index 0000000..15b1143 --- /dev/null +++ b/tests/valid/multiline-string.toml @@ -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.\ + """ diff --git a/tests/valid/raw-multiline-string.json b/tests/valid/raw-multiline-string.json new file mode 100644 index 0000000..b43cce5 --- /dev/null +++ b/tests/valid/raw-multiline-string.json @@ -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." + } +} diff --git a/tests/valid/raw-multiline-string.toml b/tests/valid/raw-multiline-string.toml new file mode 100644 index 0000000..8094c03 --- /dev/null +++ b/tests/valid/raw-multiline-string.toml @@ -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.''' diff --git a/tests/valid/raw-string.json b/tests/valid/raw-string.json new file mode 100644 index 0000000..693ab9b --- /dev/null +++ b/tests/valid/raw-string.json @@ -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." + } +} diff --git a/tests/valid/raw-string.toml b/tests/valid/raw-string.toml new file mode 100644 index 0000000..92acd25 --- /dev/null +++ b/tests/valid/raw-string.toml @@ -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.' diff --git a/tests/valid/string-escapes.json b/tests/valid/string-escapes.json index ca71d30..62dac51 100644 --- a/tests/valid/string-escapes.json +++ b/tests/valid/string-escapes.json @@ -30,5 +30,21 @@ "backslash": { "type": "string", "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." } } diff --git a/tests/valid/string-escapes.toml b/tests/valid/string-escapes.toml index 9f9a8c0..c5d4954 100644 --- a/tests/valid/string-escapes.toml +++ b/tests/valid/string-escapes.toml @@ -6,3 +6,7 @@ carriage = "This string has a \r carriage return character." quote = "This string has a \" quote character." slash = "This string has a / slash 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." diff --git a/tests/valid/unicode-escape.json b/tests/valid/unicode-escape.json index deda62c..216f8f7 100644 --- a/tests/valid/unicode-escape.json +++ b/tests/valid/unicode-escape.json @@ -1,3 +1,4 @@ { - "answer": {"type": "string", "value": "\u03B4"} + "answer4": {"type": "string", "value": "\u03B4"}, + "answer8": {"type": "string", "value": "\u03B4"} } diff --git a/tests/valid/unicode-escape.toml b/tests/valid/unicode-escape.toml index 057ce15..82faecb 100644 --- a/tests/valid/unicode-escape.toml +++ b/tests/valid/unicode-escape.toml @@ -1 +1,2 @@ -answer = "\u03B4" +answer4 = "\u03B4" +answer8 = "\U000003B4" |