diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-21 10:39:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-21 10:39:57 +0200 |
| commit | 10ba628793bac9aa26b3ca5a9484b09d1b46e8b6 (patch) | |
| tree | 0642fc66956f3e87c3e3a35a819a0be63bc2e250 /desktop/modules/sbbuilder/test_toml.js | |
| parent | e3cbb769f63813a2a2e90aa9607dcc7359a18903 (diff) | |
| download | quickshell-10ba628793bac9aa26b3ca5a9484b09d1b46e8b6.tar.gz quickshell-10ba628793bac9aa26b3ca5a9484b09d1b46e8b6.zip | |
sbbuilder: list the default manifests, and keep them on the first edit
The helper replaces its default [manifests] table with the file's, so
adding one manifest to a file without the table dropped neovim's, and
the page showed no rows for the default that was in effect. With no
table in the file the page now lists the helper's defaults, and the
first add, remove or URL edit writes them all before its own change.
Toml.js gains sections(), to tell a missing table from an empty one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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"); |
