aboutsummaryrefslogtreecommitdiffstats
path: root/ccl_test.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-30 11:04:23 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-30 11:35:15 -0700
commitb1e37119da439b52a2c1f1aca4df2fdc80462f97 (patch)
tree7eece3cb89901ebb01402745c002f4f2ff1c34ae /ccl_test.go
parentAdd benchmark (diff)
downloadccl-b1e37119da439b52a2c1f1aca4df2fdc80462f97.tar.zst
Remove the regexes
Wow it doesn't look good for regex goos: linux goarch: amd64 pkg: roseh.moe/pkg/ccl cpu: AMD Ryzen 9 5900X 12-Core Processor │ baseline.txt │ regexn't.txt │ │ sec/op │ sec/op vs base │ Lex-24 8.625µ ± 1% 1.429µ ± 0% -83.43% (p=0.000 n=20) Parse-24 18.305µ ± 0% 8.856µ ± 0% -51.62% (p=0.000 n=20) geomean 12.57µ 3.557µ -71.69%
Diffstat (limited to 'ccl_test.go')
-rw-r--r--ccl_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/ccl_test.go b/ccl_test.go
index 628009d..938af09 100644
--- a/ccl_test.go
+++ b/ccl_test.go
@@ -260,6 +260,10 @@ can just span multiple lines"`,
msg: `string: '\u2014'`,
want: message{String: "—"},
}, {
+ desc: "StringBigUnicode",
+ msg: `string: '\U0001f600'`,
+ want: message{String: "😀"},
+ }, {
desc: "StringOctal",
msg: `string: '\033'`,
want: message{String: "\033"},
@@ -357,6 +361,7 @@ func TestUnmarshal_Invalid(t *testing.T) {
type message struct {
Int int64 `ccl:"int"`
Int8 int8 `ccl:"int8"`
+ Float float64 `ccl:"float"`
String string `ccl:"string"`
Msg nestedMessage `ccl:"msg"`
Repeated []int64 `ccl:"repeated"`
@@ -372,12 +377,33 @@ func TestUnmarshal_Invalid(t *testing.T) {
desc: "BadNum",
msg: `int: .`,
}, {
+ desc: "WeirdNum",
+ msg: `float:1e+`,
+ }, {
+ desc: "BadHex",
+ msg: `int:0xgg`,
+ }, {
desc: "BadStringEscape",
msg: `string: '\g'`,
}, {
desc: "BadDoubleStringEscape",
msg: `string: "\g"`,
}, {
+ desc: "StringBadReturnEscape",
+ msg: "string:'\\\r'",
+ }, {
+ desc: "StringShortHex",
+ msg: `string:"\x1"`,
+ }, {
+ desc: "StringBadHex",
+ msg: `string:"\xgg"`,
+ }, {
+ desc: "StringShortUnicode",
+ msg: `string:"\u001"`,
+ }, {
+ desc: "StringBadUnicode",
+ msg: `string:"\ugggg"`,
+ }, {
desc: "UnterminatedString",
msg: `string: '`,
}, {