aboutsummaryrefslogtreecommitdiffstats
path: root/ccl_test.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-11-24 17:43:44 -0800
committerRose Hogenson <rosehogenson@posteo.net>2025-11-24 17:43:44 -0800
commit456b784f4ff742bf604340e62c11da47b46b2950 (patch)
tree0c8aa5fe9f44c2848247a4f7336548e967db78f0 /ccl_test.go
parent36acb0052bde87b82fb6c08d3a57680f8bea4e5f (diff)
downloadccl-456b784f4ff742bf604340e62c11da47b46b2950.tar.zst
Disallow control characters in strings
Diffstat (limited to 'ccl_test.go')
-rw-r--r--ccl_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/ccl_test.go b/ccl_test.go
index e377306..e7405f8 100644
--- a/ccl_test.go
+++ b/ccl_test.go
@@ -260,6 +260,14 @@ can just span multiple lines"`,
msg: `string: '\033'`,
want: message{String: "\033"},
}, {
+ desc: "StringStripCarriageReturn",
+ msg: "string:'a\r\nb'",
+ want: message{String: "a\nb"},
+ }, {
+ desc: "StringTab",
+ msg: "string:'\t'",
+ want: message{String: "\t"},
+ }, {
desc: "Message",
msg: `message { field: 10 }`,
want: message{Message: &nestedMessage{Field: 10}},
@@ -408,6 +416,12 @@ func TestUnmarshal_Invalid(t *testing.T) {
desc: "StringBadUnicode",
msg: `string:"\ugggg"`,
}, {
+ desc: "StringControlCharacter",
+ msg: "string:'\a'",
+ }, {
+ desc: "StringCarriageReturnNotFollowedByNewline",
+ msg: "string:'\r'",
+ }, {
desc: "UnterminatedString",
msg: `string: '`,
}, {