MCPcopy Index your code
hub / github.com/smallstep/cli / TestFileExists

Function TestFileExists

utils/read_test.go:42–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestFileExists(t *testing.T) {
43 content := []byte("my file content")
44 f, cleanup := newFile(t, content)
45 defer cleanup()
46
47 type args struct {
48 path string
49 }
50 tests := []struct {
51 name string
52 args args
53 want bool
54 }{
55 {"ok", args{f.Name()}, true},
56 {"nok", args{f.Name() + ".foo"}, false},
57 {"empty", args{""}, false},
58 }
59 for _, tt := range tests {
60 t.Run(tt.name, func(t *testing.T) {
61 if got := FileExists(tt.args.path); got != tt.want {
62 t.Errorf("FileExists() = %v, want %v", got, tt.want)
63 }
64 })
65 }
66}
67
68func TestReadAll(t *testing.T) {
69 content := []byte("read all this")

Callers

nothing calls this directly

Calls 3

newFileFunction · 0.85
FileExistsFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…