aboutsummaryrefslogtreecommitdiff
path: root/format/sideband64k/decoder_malformed_pktline_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-06 16:23:26 +0800
committerGravatar Runxi Yu2026-03-06 16:23:26 +0800
commite808bdaa15b4df61d9575192fc34cde77890da1c (patch)
tree5ca37ced633e43d5228cb0fa62520f1c6a2ca631 /format/sideband64k/decoder_malformed_pktline_test.go
parentci: Add go-fix (diff)
signatureNo signature
format/sideband64k: Add side-band-64k v0.1.66
Diffstat (limited to 'format/sideband64k/decoder_malformed_pktline_test.go')
-rw-r--r--format/sideband64k/decoder_malformed_pktline_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/format/sideband64k/decoder_malformed_pktline_test.go b/format/sideband64k/decoder_malformed_pktline_test.go
new file mode 100644
index 00000000..ffa746ca
--- /dev/null
+++ b/format/sideband64k/decoder_malformed_pktline_test.go
@@ -0,0 +1,34 @@
+package sideband64k_test
+
+import (
+ "errors"
+ "strings"
+ "testing"
+
+ "codeberg.org/lindenii/furgit/format/pktline"
+ "codeberg.org/lindenii/furgit/format/sideband64k"
+)
+
+func TestDecoderInvalid0003(t *testing.T) {
+ t.Parallel()
+
+ dec := sideband64k.NewDecoder(strings.NewReader("0003"), sideband64k.ReadOptions{})
+ _, err := dec.ReadFrame()
+
+ var pe *pktline.ProtocolError
+ if !errors.As(err, &pe) {
+ t.Fatalf("got err %v, want pktline.ProtocolError", err)
+ }
+}
+
+func TestDecoderRejectsOverMaximumLength(t *testing.T) {
+ t.Parallel()
+
+ dec := sideband64k.NewDecoder(strings.NewReader("fffe"), sideband64k.ReadOptions{})
+ _, err := dec.ReadFrame()
+
+ var pe *pktline.ProtocolError
+ if !errors.As(err, &pe) {
+ t.Fatalf("got err %v, want pktline.ProtocolError", err)
+ }
+}