summaryrefslogtreecommitdiff
path: root/std/encoding
diff options
context:
space:
mode:
Diffstat (limited to 'std/encoding')
-rw-r--r--std/encoding/testdata/boolean.toml3
-rw-r--r--std/encoding/toml.ts2
-rw-r--r--std/encoding/toml_test.ts2
3 files changed, 4 insertions, 3 deletions
diff --git a/std/encoding/testdata/boolean.toml b/std/encoding/testdata/boolean.toml
index 242d29c96..e3e287981 100644
--- a/std/encoding/testdata/boolean.toml
+++ b/std/encoding/testdata/boolean.toml
@@ -1,3 +1,4 @@
[boolean] # i hate comments
bool1 = true
-bool2 = false \ No newline at end of file
+bool2 = false
+bool3 = true # I love comments \ No newline at end of file
diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts
index 43788c06a..336af97fb 100644
--- a/std/encoding/toml.ts
+++ b/std/encoding/toml.ts
@@ -280,7 +280,7 @@ class Parser {
return dataString.slice(0, endOfString);
}
- const m = /(?:|\[|{|).*(?:|\]||})\s*[^#]/g.exec(dataString);
+ const m = /(?:|\[|{).*(?:|\]|})\s*^((?!#).)*/g.exec(dataString);
if (m) {
return m[0].trim();
} else {
diff --git a/std/encoding/toml_test.ts b/std/encoding/toml_test.ts
index 45d0a66e6..0a927cde9 100644
--- a/std/encoding/toml_test.ts
+++ b/std/encoding/toml_test.ts
@@ -48,7 +48,7 @@ Deno.test({
Deno.test({
name: "[TOML] Boolean",
fn(): void {
- const expected = { boolean: { bool1: true, bool2: false } };
+ const expected = { boolean: { bool1: true, bool2: false, bool3: true } };
const actual = parseFile(path.join(testFilesDir, "boolean.toml"));
assertEquals(actual, expected);
},