Skip to content

Commit

Permalink
test: add embedded testdata
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Ege <[email protected]>
  • Loading branch information
graugans committed Dec 23, 2023
1 parent 609086d commit 1c6f25b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/pcic/protocol_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pcic_test

import (
"embed"
"fmt"
"strings"
"testing"
Expand All @@ -12,6 +13,9 @@ import (

const miniMalContentLength int = 14

//go:embed testdata/*.bz2
var tfs embed.FS

func TestMinimalReceive(t *testing.T) {
r := strings.NewReader("Hello, Reader!")
p := pcic.PCIC{}
Expand Down Expand Up @@ -70,3 +74,9 @@ func TestReceiveWithChunk(t *testing.T) {
assert.Error(t, err, "We expect an error while receiving malformed data")

}

func TestWithRealData(t *testing.T) {
_, err := tfs.ReadFile("testdata/pcic-test-data.blob.bz2")
assert.NoError(t, err, "No error expected while reading the input")

}

0 comments on commit 1c6f25b

Please sign in to comment.