aboutsummaryrefslogtreecommitdiffstats
path: root/asspb_test.go
diff options
context:
space:
mode:
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)
+ }
+}