Skip to content

Commit dd6d315

Browse files
committed
Add in-memory fs example
1 parent 7a7f664 commit dd6d315

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ require (
9898
github.com/pion/udp v0.1.1 // indirect
9999
github.com/pkg/errors v0.9.1 // indirect
100100
github.com/pmezard/go-difflib v1.0.0 // indirect
101+
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef // indirect
101102
github.com/sirupsen/logrus v1.8.1 // indirect
102103
github.com/spf13/pflag v1.0.5 // indirect
103104
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
10871087
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
10881088
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
10891089
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
1090+
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef h1:NKxTG6GVGbfMXc2mIk+KphcH6hagbVXhcFkbTgYleTI=
1091+
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI=
10901092
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
10911093
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
10921094
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=

nextrouter/nextrouter_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package nextrouter_test
2+
3+
import (
4+
"io/fs"
5+
"testing"
6+
7+
"github.com/psanford/memfs"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
func TestConn(t *testing.T) {
12+
t.Parallel()
13+
14+
t.Run("Smoke test", func(t *testing.T) {
15+
t.Parallel()
16+
17+
rootFS := memfs.New()
18+
err := rootFS.MkdirAll("test/a/b", 0777)
19+
require.NoError(t, err)
20+
21+
rootFS.WriteFile("test/a/b/c.txt", []byte("test123"), 0755)
22+
content, err := fs.ReadFile(rootFS, "test/a/b/c.txt")
23+
require.NoError(t, err)
24+
25+
require.Equal(t, string(content), "test123")
26+
27+
//require.Equal(t, 1, 2)
28+
})
29+
}

0 commit comments

Comments
 (0)