MCPcopy
hub / github.com/urfave/cli / TestFilePaths

Function TestFilePaths

value_source_test.go:118–131  ·  value_source_test.go::TestFilePaths
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func TestFilePaths(t *testing.T) {
119 r := require.New(t)
120
121 fileName := filepath.Join(os.TempDir(), fmt.Sprintf("urfave-cli-tests-some_file_name_%[1]v", rand.Int()))
122 t.Cleanup(func() { _ = os.Remove(fileName) })
123
124 r.Nil(os.WriteFile(fileName, []byte("Hello"), 0o644))
125
126 sources := Files("junk_file_name", fileName)
127 str, src, ok := sources.LookupWithSource()
128 r.True(ok)
129 r.Equal(str, "Hello")
130 r.Contains(src.String(), fmt.Sprintf("%[1]q", fileName))
131}
132
133func TestValueSourceChainEnvKeys(t *testing.T) {
134 chain := NewValueSourceChain(

Callers

nothing calls this directly

Calls 4

FilesFunction · 0.85
IntMethod · 0.80
LookupWithSourceMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected