[bug#78013] guix: toml: Add missing escape pattern.
Commit Message
* guix/build/toml.scm (eval-toml-file): Add missing mappings.
* tests/toml.scm ("parse-toml: String escapes"): Test all escapes from
the specification.
Change-Id: I135f6eebd8c7903eb6ebac1120c0ef071779f4ec
---
guix/build/toml.scm | 2 ++
tests/toml.scm | 4 ++++
2 files changed, 6 insertions(+)
base-commit: b12d44dd5e35ac236bf3fbb5619b9c8c2f42c902
@@ -402,6 +402,8 @@ (define (eval-toml-file parse-tree)
(('escaped "b") "\b")
(('escaped "t") "\t")
(('escaped "n") "\n")
+ (('escaped "f") "\f")
+ (('escaped "r") "\r")
(('escaped (? (lambda (x) (>= (string-length x) 4)) u))
(list->string (list (integer->char (string->number u 16)))))
((? string? s) s))
@@ -97,6 +97,10 @@ (define-module (test-toml)
'(("str" . "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."))
(parse-toml "str = \"I'm a string. \\\"You can quote me\\\". Name\\tJos\\u00E9\\nLocation\\tSF.\""))
+(test-equal "parse-toml: String escapes"
+ '(("str" . "\b\t\n\f\r\"\\"))
+ (parse-toml "str = \"\\b\\t\\n\\f\\r\\\"\\\\\""))
+
(test-equal "parse-toml: Empty string"
'(("str1" . "")
("str2" . "")