MCPcopy Index your code
hub / github.com/bitfield/script / TestIfExists_ProducesErrorPlusNoOutputForNonexistentFile

Function TestIfExists_ProducesErrorPlusNoOutputForNonexistentFile

script_test.go:1332–1342  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1330}
1331
1332func TestIfExists_ProducesErrorPlusNoOutputForNonexistentFile(t *testing.T) {
1333 t.Parallel()
1334 want := ""
1335 got, err := script.IfExists("testdata/doesntexist").Echo("hello").String()
1336 if err == nil {
1337 t.Fatal("want error")
1338 }
1339 if want != got {
1340 t.Error(cmp.Diff(want, got))
1341 }
1342}
1343
1344func TestIfExists_ProducesOutputAndNoErrorWhenFileExists(t *testing.T) {
1345 t.Parallel()

Callers

nothing calls this directly

Calls 4

IfExistsFunction · 0.92
StringMethod · 0.80
EchoMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…