aboutsummaryrefslogtreecommitdiffstats
path: root/asspb_test.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-26 10:27:25 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-26 10:27:25 -0700
commit3cf45c5a15a14a32061e24717539ae1825c3ac78 (patch)
tree564ae3f8d5b5ca8fe0d8aec133e44b3625155ab4 /asspb_test.go
parenta57d0891f3a2cb25cd7824d2e0a7d620f6288864 (diff)
downloadccl-3cf45c5a15a14a32061e24717539ae1825c3ac78.tar.zst
Improve error messages
Diffstat (limited to 'asspb_test.go')
-rw-r--r--asspb_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/asspb_test.go b/asspb_test.go
index b974b2f..4280dae 100644
--- a/asspb_test.go
+++ b/asspb_test.go
@@ -287,3 +287,21 @@ func TestUnmarshal_Invalid(t *testing.T) {
})
}
}
+
+func TestUnmarshal_ErrorLineCol(t *testing.T) {
+ msg := `
+ ###### This is a very important file please do not modify
+ #########################################################
+ ################ The more ## I put the more secure it is######
+ secret:12345; # oops typo
+ `
+ err := Unmarshal([]byte(msg), new(map[string]any))
+ syntaxErr, ok := err.(*syntaxError)
+ if !ok {
+ t.Errorf("Unmarshal(%q): expected *syntaxError, got error %T %[2]v", msg, err)
+ }
+ want := &syntaxError{line: 5, col: 15}
+ if syntaxErr.line != want.line || syntaxErr.col != want.col {
+ t.Errorf("Unmarshal(%q) returned error %+v, want line %d, col %d", msg, syntaxErr, want.line, want.col)
+ }
+}