toml icon indicating copy to clipboard operation
toml copied to clipboard

`toml_edit` error regression compared to `toml`: string parse errors don't tell user what went wrong

Open epage opened this issue 2 years ago • 0 comments

     bad!(
         "a = \"\r\"",
-        "invalid character in string: `\\r` at line 1 column 6"
+        "\
+TOML parse error at line 1, column 6
+  |
+1 | a = \"\r
+\"
+  |      ^
+invalid basic string
+"
-    bad!("a = \"\n\"", "newline in string found at line 1 column 6");
-    bad!("a = '\n'", "newline in string found at line 1 column 6");
+    bad!(
+        "a = \"\n\"",
+        "\
+TOML parse error at line 1, column 6
+  |
+1 | a = \"
+  |      ^
+invalid basic string
+"
+    );
+    bad!(
+        "a = '\n'",
+        "\
+TOML parse error at line 1, column 6
+  |
+1 | a = '
+  |      ^
+invalid literal string
+"
+    );
 }

epage avatar Jan 18 '23 03:01 epage