commit f9736c3afa16a8d3ddbc38385008712daf53061c
parent cd855a52e4b61839ee5cf0092158bdd035a2612c
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 13:16:31 +0200
util: test that % introduces a config comment
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/packages/taler-util/src/talerconfig.test.ts b/packages/taler-util/src/talerconfig.test.ts
@@ -169,3 +169,25 @@ test("tabs are whitespace, as in the C implementation", (t) => {
"foo bar",
);
});
+
+test("% introduces a comment, as in the C implementation", (t) => {
+ // configuration.c treats both '#' and '%' as comment introducers.
+ const config = new Configuration();
+ config.loadFromString(
+ [
+ "% a comment",
+ "[exchange]",
+ "BASE_URL = https://real/",
+ " % BASE_URL = https://old/",
+ "",
+ ].join("\n"),
+ );
+ assert.strictEqual(
+ config.getString("exchange", "base_url").required(),
+ "https://real/",
+ );
+ assert.strictEqual(
+ config.stringify(),
+ "[EXCHANGE]\nBASE_URL = https://real/\n\n",
+ );
+});