Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 4 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ flat_map_option = "warn"
float_cmp_const = "warn"
fn_params_excessive_bools = "warn"
from_iter_instead_of_collect = "warn"
get_first = "allow"
if_same_then_else = "allow"
implicit_clone = "warn"
imprecise_flops = "warn"
Expand All @@ -64,6 +65,7 @@ mem_forget = "warn"
mutex_integer = "warn"
needless_continue = "allow"
needless_for_each = "warn"
needless_bool = "allow"
negative_feature_names = "warn"
path_buf_push_overwrite = "warn"
ptr_as_ptr = "warn"
Expand Down
42 changes: 21 additions & 21 deletions crates/toml/tests/compliance/invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TOML parse error at line 1, column 6
|
1 | a = ""
| ^
invalid basic string
invalid basic string, expected non-double-quote visible characters, `\`

"#]],
);
Expand All @@ -35,7 +35,7 @@ TOML parse error at line 1, column 6
|
1 | a = ''
| ^
invalid literal string
invalid literal string, expected non-single-quote visible characters

"#]],
);
Expand All @@ -46,11 +46,11 @@ fn stray_cr() {
t(
"\r",
str![[r#"
TOML parse error at line 1, column 1
TOML parse error at line 1, column 2
|
1 |
| ^

| ^
carriage return must be followed by newline, expected newline

"#]],
);
Expand All @@ -62,44 +62,43 @@ TOML parse error at line 1, column 8
1 | a = [
]
| ^

carriage return must be followed by newline, expected newline

"#]],
);
t(
"a = \"\"\"\r\"\"\"",
str![[r#"
TOML parse error at line 1, column 8
TOML parse error at line 1, column 9
|
1 | a = """
"""
| ^
invalid multiline basic string
| ^
carriage return must be followed by newline, expected newline

"#]],
);
t(
"a = \"\"\"\\ \r \"\"\"",
str![[r#"
TOML parse error at line 1, column 10
TOML parse error at line 1, column 12
|
1 | a = """\
"""
| ^
invalid escape sequence
expected `b`, `f`, `n`, `r`, `t`, `u`, `U`, `\`, `"`
| ^
carriage return must be followed by newline, expected newline

"#]],
);
t(
"a = '''\r'''",
str![[r#"
TOML parse error at line 1, column 8
TOML parse error at line 1, column 9
|
1 | a = '''
'''
| ^
invalid multiline literal string
| ^
carriage return must be followed by newline, expected newline

"#]],
);
Expand All @@ -111,7 +110,7 @@ TOML parse error at line 1, column 6
1 | a = '
'
| ^
invalid literal string
invalid literal string, expected non-single-quote visible characters

"#]],
);
Expand All @@ -123,7 +122,7 @@ TOML parse error at line 1, column 6
1 | a = "
"
| ^
invalid basic string
invalid basic string, expected non-double-quote visible characters, `\`

"#]],
);
Expand All @@ -143,7 +142,7 @@ TOML parse error at line 5, column 1
|
5 | a = 2
| ^
duplicate key `a` in table `t2`
duplicate key

"#]],
);
Expand All @@ -166,7 +165,7 @@ fn text_error_span() {
let err = input.parse::<crate::RustDocument>().unwrap_err();
dbg!(&err);
let actual = &input[err.span().unwrap()];
assert_eq!(actual, "a");
assert_eq!(actual, "asdf");
}

#[test]
Expand All @@ -176,5 +175,6 @@ fn fuzzed_68144_error_span() {
let err = input.parse::<crate::RustDocument>().unwrap_err();
dbg!(&err);
let actual = &input[err.span().unwrap()];
assert_eq!(actual, "ᾂ");
// atm bad escape values are reported as missing escape values
assert_eq!(actual, "");
}
10 changes: 3 additions & 7 deletions crates/toml/tests/serde/spanned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ fn test_spanned_field() {
0,
"incorrect `foo_outer.span().start`"
);
assert_eq!(
foo_outer.span().end,
input.len(),
"incorrect `foo_outer.span().end`"
);
assert_eq!(foo_outer.span().end, 0, "incorrect `foo_outer.span().end`");
assert_eq!(
foo.foo.into_inner(),
foo_outer.into_inner().foo,
Expand Down Expand Up @@ -125,7 +121,7 @@ fn test_inner_spanned_table() {

if zero {
assert_eq!(foo.foo.span().start, 0, "invalid `foo.foo.span().start`");
assert_eq!(foo.foo.span().end, 73, "invalid `foo.foo.span().end`");
assert_eq!(foo.foo.span().end, 5, "invalid `foo.foo.span().end`");
} else {
assert_eq!(
foo.foo.span().start,
Expand Down Expand Up @@ -269,7 +265,7 @@ fn test_spanned_array() {
";
let foo_list: Foo = crate::from_str(toml).unwrap();

for (foo, expected) in foo_list.foo.iter().zip([0..75, 84..159]) {
for (foo, expected) in foo_list.foo.iter().zip([0..7, 84..91]) {
assert_eq!(foo.span(), expected);
for (k, v) in foo.as_ref().iter() {
assert_eq!(&toml[k.span().start..k.span().end], k.as_ref());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 21
|
1 | double-comma-1 = [1,,2]
| ^
invalid array
expected `]`
extra comma in array, expected value
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 23
|
1 | double-comma-2 = [1,2,,]
| ^
invalid array
expected `]`
extra comma in array, expected value
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 21
|
1 | double-comma-1 = [1,,2]
| ^
invalid array
expected `]`
extra comma in array, expected value
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 23
|
1 | double-comma-2 = [1,2,,]
| ^
invalid array
expected `]`
extra comma in array, expected value
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TOML parse error at line 3, column 1
TOML parse error at line 3, column 5
|
3 | arr.val1=1
| ^
duplicate key `val1`
| ^^^^
duplicate key
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TOML parse error at line 5, column 1
TOML parse error at line 5, column 2
|
5 | [a.c]
| ^
invalid table header
dotted key `a` attempted to extend non-table type (array)
| ^
cannot extend value of type array with a dotted key
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TOML parse error at line 1, column 14
TOML parse error at line 1, column 9
|
1 | arrr = [true false]
| ^
invalid array
expected `]`
| ^^^^^^^^^^
invalid boolean, expected `true`
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TOML parse error at line 1, column 13
TOML parse error at line 1, column 15
|
1 | wrong = [ 1 2 3 ]
| ^
invalid array
expected `]`
| ^
missing comma between array elements, expected `,`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-01.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 24
|
1 | no-close-1 = [ 1, 2, 3
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-02.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 18
|
1 | no-close-2 = [1,
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-03.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 21
|
1 | no-close-3 = [42 #]
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-04.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 25
|
1 | no-close-4 = [{ key = 42
| ^
invalid inline table
expected `}`
newlines are unsupported in inline tables, expected nothing
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-05.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 27
|
1 | no-close-5 = [{ key = 42}
| ^
invalid array
expected `]`
unclosed array, expected `]`
5 changes: 2 additions & 3 deletions crates/toml/tests/snapshots/invalid/array/no-close-06.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TOML parse error at line 1, column 26
|
1 | no-close-6 = [{ key = 42 #}]
| ^
invalid inline table
expected `}`
| ^^^
comments are unsupported in inline tables, expected nothing
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-07.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 30
|
1 | no-close-7 = [{ key = 42} #]
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-08.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 16
|
1 | no-close-8 = [
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 24
|
1 | no-close-1 = [ 1, 2, 3
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 18
|
1 | no-close-2 = [1,
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 21
|
1 | no-close-3 = [42 #]
| ^
invalid array
expected `]`
unclosed array, expected `]`
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-4.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 25
|
1 | no-close-4 = [{ key = 42
| ^
invalid inline table
expected `}`
newlines are unsupported in inline tables, expected nothing
3 changes: 1 addition & 2 deletions crates/toml/tests/snapshots/invalid/array/no-close-5.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ TOML parse error at line 1, column 27
|
1 | no-close-5 = [{ key = 42}
| ^
invalid array
expected `]`
unclosed array, expected `]`
Loading
Loading