From 10ba628793bac9aa26b3ca5a9484b09d1b46e8b6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 21 Oct 2026 10:39:57 +0200 Subject: 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 --- desktop/modules/sbbuilder/test_toml.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'desktop/modules/sbbuilder/test_toml.js') 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"); -- cgit v1.2.3