MCPcopy Create free account
hub / github.com/cli/cli / TestNewAssetMissingFile

Function TestNewAssetMissingFile

internal/attachments/userasset_test.go:260–269  ·  view source on GitHub ↗

A missing file reports the path the user typed rather than the syscall gh happened to make. The reason text comes from the operating system, so this checks the shape and the cause instead of the whole string.

(t *testing.T)

Source from the content-addressed store, hash-verified

258// happened to make. The reason text comes from the operating system, so this
259// checks the shape and the cause instead of the whole string.
260func TestNewAssetMissingFile(t *testing.T) {
261 t.Chdir(t.TempDir())
262
263 _, err := newAsset("./nope.png", "")
264
265 require.Error(t, err)
266 assert.True(t, strings.HasPrefix(err.Error(), "./nope.png: "), "got %q", err.Error())
267 assert.NotContains(t, err.Error(), "stat ")
268 assert.ErrorIs(t, err, fs.ErrNotExist)
269}
270
271func TestAssetMarkdown(t *testing.T) {
272 tests := []struct {

Callers

nothing calls this directly

Calls 2

newAssetFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected