Shit ton of tests

This commit is contained in:
Melody Becker 2025-04-24 15:59:15 +02:00
parent 99b00887a8
commit ccf98c2f6e
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
13 changed files with 1157 additions and 1 deletions

View file

@ -0,0 +1,27 @@
package embedFsWrapper_test
import (
"io"
"testing"
"testing/fstest"
"git.mstar.dev/mstar/goutils/embedFsWrapper"
)
func TestFSWrapper(t *testing.T) {
mfs := fstest.MapFS{
"baz/foo": &fstest.MapFile{Data: []byte("bar")},
}
wrapped := embedFsWrapper.NewFSWrapper(mfs, "baz/")
f, err := wrapped.Open("foo")
if err != nil {
t.Fatalf("Expected to open file foo (baz/foo), got %v", err)
}
data, err := io.ReadAll(f)
if err != nil {
t.Fatal(err)
}
if string(data) != "bar" {
t.Fatalf("Expected file to have \"bar\" as content, found %v", string(data))
}
}