MCPcopy
hub / github.com/dagger/dagger / TestMatchVersion

Function TestMatchVersion

core/modulerefs_test.go:12–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestMatchVersion(t *testing.T) {
13 vers := []string{"v1.0.0", "v1.0.1", "v2.0.0", "path/v1.0.1", "path/v2.0.1"}
14
15 match1, err := matchVersion(vers, "v1.0.1", "/")
16 require.NoError(t, err)
17 require.Equal(t, "v1.0.1", match1)
18
19 match2, err := matchVersion(vers, "v1.0.1", "path")
20 require.NoError(t, err)
21 require.Equal(t, "path/v1.0.1", match2)
22
23 match3, err := matchVersion(vers, "v1.0.1", "/path")
24 require.NoError(t, err)
25 require.Equal(t, "path/v1.0.1", match3)
26
27 _, err = matchVersion(vers, "v2.0.1", "/")
28 require.Error(t, err)
29
30 _, err = matchVersion([]string{"hello/v0.3.0"}, "v0.3.0", "/hello")
31 require.NoError(t, err)
32}
33
34// Test ParseRefString using an interface to control Host side effect
35func TestParseRefString(t *testing.T) {

Callers

nothing calls this directly

Calls 3

matchVersionFunction · 0.70
EqualMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected