MCPcopy Index your code
hub / github.com/coder/coder / TestRemoveTrailingVersionInfo

Function TestRemoveTrailingVersionInfo

codersdk/deployment_internal_test.go:9–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestRemoveTrailingVersionInfo(t *testing.T) {
10 t.Parallel()
11
12 testCases := []struct {
13 Version string
14 ExpectedAfterStrippingInfo string
15 }{
16 {
17 Version: "v2.16.0+683a720",
18 ExpectedAfterStrippingInfo: "v2.16.0",
19 },
20 {
21 Version: "v2.16.0-devel+683a720",
22 ExpectedAfterStrippingInfo: "v2.16.0",
23 },
24 {
25 Version: "v2.16.0+683a720-devel",
26 ExpectedAfterStrippingInfo: "v2.16.0",
27 },
28 // RC versions: preserve the -rc.X suffix, strip build metadata.
29 {
30 Version: "v2.32.0-rc.1+abc123",
31 ExpectedAfterStrippingInfo: "v2.32.0-rc.1",
32 },
33 {
34 Version: "v2.32.0-rc.0",
35 ExpectedAfterStrippingInfo: "v2.32.0-rc.0",
36 },
37 {
38 Version: "v2.32.0-rc.1+683a720-devel",
39 ExpectedAfterStrippingInfo: "v2.32.0-rc.1",
40 },
41 // Bare devel suffix, no build metadata.
42 {
43 Version: "v2.32.0-devel",
44 ExpectedAfterStrippingInfo: "v2.32.0",
45 },
46 // Plain release, identity case.
47 {
48 Version: "v2.16.0",
49 ExpectedAfterStrippingInfo: "v2.16.0",
50 },
51 }
52
53 for _, tc := range testCases {
54 t.Run(tc.Version, func(t *testing.T) {
55 t.Parallel()
56 stripped := removeTrailingVersionInfo(tc.Version)
57 require.Equal(t, tc.ExpectedAfterStrippingInfo, stripped)
58 })
59 }
60}

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected