MCPcopy
hub / github.com/google/gopacket / TestCaptureInfoErrors

Function TestCaptureInfoErrors

pcapgo/write_test.go:82–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestCaptureInfoErrors(t *testing.T) {
83 data := []byte{1, 2, 3, 4}
84 ts := time.Unix(0, 0)
85 for _, test := range []gopacket.CaptureInfo{
86 gopacket.CaptureInfo{
87 Timestamp: ts,
88 Length: 5,
89 CaptureLength: 5,
90 },
91 gopacket.CaptureInfo{
92 Timestamp: ts,
93 Length: 3,
94 CaptureLength: 4,
95 },
96 } {
97 var buf bytes.Buffer
98 w := NewWriter(&buf)
99 if err := w.WritePacket(test, data); err == nil {
100 t.Errorf("CaptureInfo %+v should have error", test)
101 }
102 }
103}

Callers

nothing calls this directly

Calls 2

WritePacketMethod · 0.95
NewWriterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…