From d111a6a60d3535933e4b6eba7007519b3e9d6835 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 1 Sep 2025 17:05:23 +0200 Subject: guix: toml: Fix keys with embedded escape codes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quoted keys are treated by the specification like ordinary strings, so escape codes must be handled as well. * guix/build/toml.scm (eval-value): Move string escape handling… (eval-value): …here. (eval-toml-file): Un-escape quoted keys. * tests/toml.scm ("parse-toml: Quoted keys with escapes"): New testcase. Fixes: guix/guix#2414 Change-Id: I612e415cc93207bbdd18b6ec8279255fee16670a Signed-off-by: Sharlatan Hellseher --- tests/toml.scm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/toml.scm b/tests/toml.scm index 64bc667f0c9..955a9967b21 100644 --- a/tests/toml.scm +++ b/tests/toml.scm @@ -54,6 +54,12 @@ bare-key = \"value\" 'key2' = \"value\" 'quoted \"value\"' = \"value\"")) +(test-equal "parse-toml: Quoted keys with escapes" + '(("key \\ with \n escapes" . "value") + ("key" ("with \t escapes" ("and \n dots" . "value")))) + (parse-toml "\"key \\\\ with \\n escapes\" = \"value\" +key.\"with \\t escapes\".\"and \\n dots\" = \"value\"")) + (test-equal "parse-toml: No key" #f (parse-toml "= \"no key name\"")) -- cgit v1.3