@@ -140,10 +140,9 @@ invalid!(eof, "key =");
140140mod bad_inline_tables {
141141 use super :: invalid;
142142
143- invalid ! ( trailing_comma, "a = {a=1,}" ) ;
143+ // TOML 1.1: trailing_comma and newline are now valid, so removed from invalid tests
144144 invalid ! ( only_comma, "a = {,}" ) ;
145145 invalid ! ( duplicate_key, "a = {a=1,a=1}" ) ;
146- invalid ! ( newline, "a = {\n }" ) ;
147146 invalid ! ( eof, "a = {" ) ;
148147}
149148
@@ -307,3 +306,58 @@ mod require_newlines {
307306 invalid ! ( basic2, "0=0r0=0r=false" ) ;
308307 invalid ! ( basic3, "0=0r0=0r=falsefal=false" ) ;
309308}
309+
310+ // TOML 1.1 features
311+ mod toml_1_1 {
312+ use super :: valid;
313+
314+ // Inline tables can now have newlines
315+ valid ! (
316+ inline_table_newlines,
317+ r#"
318+ tbl = {
319+ key = "value",
320+ nested = {
321+ inner = 42,
322+ },
323+ }
324+ "#
325+ ) ;
326+
327+ // Trailing commas in inline tables
328+ valid ! ( inline_table_trailing_comma, "a = {a=1,}" ) ;
329+
330+ // Empty inline table with newlines
331+ valid ! ( inline_table_empty_newlines, "a = {\n }" ) ;
332+
333+ // \e escape sequence (escape character U+001B)
334+ valid ! ( escape_e, r#"csi = "\e[""# ) ;
335+
336+ // \xHH escape sequence for codepoints < 255
337+ valid ! (
338+ escape_x,
339+ r#"
340+ null = "\x00"
341+ letter = "\x61"
342+ "#
343+ ) ;
344+
345+ // Combined escape sequences
346+ valid ! (
347+ escape_combined,
348+ r#"test = "\x00\x1b\e\x61\u0041\U00000042""#
349+ ) ;
350+
351+ // Complex inline table with comments
352+ valid ! (
353+ inline_table_with_comments,
354+ r#"
355+ tbl = {
356+ # This is a comment
357+ key = "value",
358+ # Another comment
359+ num = 123,
360+ }
361+ "#
362+ ) ;
363+ }
0 commit comments