MCPcopy Create free account
hub / github.com/dim-an/cod / TestCanonizeExecutablePath

Function TestCanonizeExecutablePath

datastore/data_test.go:24–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestCanonizeExecutablePath(t *testing.T) {
25 var (
26 canonized string
27 err error
28 )
29
30 canonized, err = CanonizeExecutablePath("foo", "/a/b", "", "")
31 require.Error(t, util.ErrBinaryNotFound, err)
32
33 canonized, err = CanonizeExecutablePath("./foo", "/a/b", "", "")
34 require.Nil(t, err)
35 require.Equal(t, "/a/b/foo", canonized)
36
37 canonized, err = CanonizeExecutablePath("../foo", "/a/b", "", "")
38 require.Nil(t, err)
39 require.Equal(t, "/a/foo", canonized)
40
41 canonized, err = CanonizeExecutablePath("/foo", "/a/b", "", "")
42 require.Nil(t, err)
43 require.Equal(t, "/foo", canonized)
44
45 canonized, err = CanonizeExecutablePath("~/foo", "/a/b", "", "")
46 require.Error(t, err)
47
48 canonized, err = CanonizeExecutablePath("~/foo", "/a/b", "", "/home/user")
49 require.NoError(t, err)
50 require.Equal(t, "/home/user/foo", canonized)
51}
52
53func TestIsCommandMatchingContext(t *testing.T) {
54 require.Equal(t, true,

Callers

nothing calls this directly

Calls 2

CanonizeExecutablePathFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected