MCPcopy Create free account
hub / github.com/bufbuild/buf / TestNormalizeAndValidate

Function TestNormalizeAndValidate

private/pkg/normalpath/normalpath_unix_test.go:30–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNormalizeAndValidate(t *testing.T) {
31 t.Parallel()
32 path, err := NormalizeAndValidate("")
33 assert.NoError(t, err)
34 assert.Equal(t, ".", path)
35 path, err = NormalizeAndValidate(".")
36 assert.NoError(t, err)
37 assert.Equal(t, ".", path)
38 path, err = NormalizeAndValidate("./.")
39 assert.NoError(t, err)
40 assert.Equal(t, ".", path)
41 path, err = NormalizeAndValidate("./foo")
42 assert.NoError(t, err)
43 assert.Equal(t, "foo", path)
44
45 _, err = NormalizeAndValidate("/foo")
46 assert.Error(t, err)
47
48 _, err = NormalizeAndValidate("../foo")
49 assert.Error(t, err)
50
51 _, err = NormalizeAndValidate("..")
52 assert.Error(t, err)
53}
54
55func TestNormalize(t *testing.T) {
56 t.Parallel()

Callers

nothing calls this directly

Calls 2

NormalizeAndValidateFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…