commit 1b4ff2f45f2b91448bc75fedd35eb48d49f057f4
parent 595d18a63409d3cbee85edb7b97e02072f48dfdc
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 20:00:27 +0200
util: test that a substitution default may contain ":-"
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/packages/taler-util/src/talerconfig.test.ts b/packages/taler-util/src/talerconfig.test.ts
@@ -51,6 +51,17 @@ test("pathsub", (t) => {
"hello blabla!",
);
+ // The default is everything after the first ":-", as in the C
+ // implementation, which takes the rest of the expression verbatim.
+ assert.strictEqual(
+ pathsub("${x:-a:-b}", (v) => d[v]),
+ "a:-b",
+ );
+ assert.strictEqual(
+ pathsub("${x:-http://example.com/a:-b}", (v) => d[v]),
+ "http://example.com/a:-b",
+ );
+
// No braces
assert.strictEqual(
pathsub("hello $w!", (v) => d[v]),