summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccwl/yaml.scm4
-rw-r--r--tests/yaml.scm5
2 files changed, 7 insertions, 2 deletions
diff --git a/ccwl/yaml.scm b/ccwl/yaml.scm
index a891c60..19f26c2 100644
--- a/ccwl/yaml.scm
+++ b/ccwl/yaml.scm
@@ -54,9 +54,9 @@ ATOM is a symbol."
;; Escape string with double quotes if
;; - every character is a digit or period, and the unescaped
;; string can therefore be misinterpreted as a number
- ;; - string contains the colon or hyphen characters
+ ;; - string contains the colon, hyphen or asterisk characters
(if (or (string-every (char-set-union char-set:digit (char-set #\.)) atom)
- (string-any (char-set #\: #\-) atom))
+ (string-any (char-set #\: #\- #\*) atom))
(write atom port)
(display atom port)))
((boolean? atom)
diff --git a/tests/yaml.scm b/tests/yaml.scm
index 073f1e5..70c6cea 100644
--- a/tests/yaml.scm
+++ b/tests/yaml.scm
@@ -34,4 +34,9 @@ bar: {}
"
(scm->yaml-string #("-1")))
+(test-equal "strings with asterisk characters should be escaped"
+ "- \"*foo\"
+"
+ (scm->yaml-string #("*foo")))
+
(test-end "yaml")