diff options
Diffstat (limited to 'desktop/modules/sbbuilder/test_toml.js')
| -rw-r--r-- | desktop/modules/sbbuilder/test_toml.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/desktop/modules/sbbuilder/test_toml.js b/desktop/modules/sbbuilder/test_toml.js index 8378519..c86741d 100644 --- a/desktop/modules/sbbuilder/test_toml.js +++ b/desktop/modules/sbbuilder/test_toml.js @@ -18,7 +18,7 @@ const assert = require("assert"); const src = fs.readFileSync(__dirname + "/Toml.js", "utf8") .replace(/^\.pragma library$/m, ""); -const T = new Function(src + "\nreturn { entries, get, set, remove };")(); +const T = new Function(src + "\nreturn { sections, entries, get, set, remove };")(); const file = [ "# helper config", @@ -97,4 +97,9 @@ t = T.remove(file, "manifests", "gtk+3"); assert.deepStrictEqual(T.entries(t, "manifests").map(e => e.key), ["neovim"]); assert.strictEqual(T.remove(file, "manifests", "nope"), file); +// sections tells a missing table from an empty one, which entries cannot. +assert.deepStrictEqual(T.sections(file), ["manifests", "refresh"]); +assert.deepStrictEqual(T.sections("a = 1\n[manifests]\n"), ["manifests"]); +assert.deepStrictEqual(T.sections("a = 1\n"), []); + console.log("test_toml: ok"); |
