MCPcopy Create free account
hub / github.com/docker/docker-language-server / TestInlayHint

Function TestInlayHint

internal/dockerfile/inlayHint_test.go:18–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestInlayHint(t *testing.T) {
19 // set timezone to UTC for this test so the locale is consistent
20 origTZ := os.Getenv("TZ")
21 require.NoError(t, os.Setenv("TZ", "UTC"))
22 t.Cleanup(func() {
23 require.NoError(t, os.Setenv("TZ", origTZ))
24 })
25
26 testCases := []struct {
27 name string
28 content string
29 rng protocol.Range
30 inlayHints []protocol.InlayHint
31 }{
32 {
33 name: "alpine",
34 content: "FROM alpine",
35 rng: protocol.Range{
36 Start: protocol.Position{Line: 0, Character: 0},
37 End: protocol.Position{Line: 0, Character: 11},
38 },
39 inlayHints: []protocol.InlayHint{},
40 },
41 {
42 name: "alpine:3.16",
43 content: "FROM alpine:3.16",
44 rng: protocol.Range{
45 Start: protocol.Position{Line: 0, Character: 0},
46 End: protocol.Position{Line: 0, Character: 16},
47 },
48 inlayHints: []protocol.InlayHint{
49 {
50 Label: "(last pushed 1 year ago)",
51 PaddingLeft: types.CreateBoolPointer(true),
52 Position: protocol.Position{Line: 0, Character: 16},
53 Tooltip: types.CreateAnyPointer("2024-01-27 00:47:58 UTC"),
54 },
55 },
56 },
57 {
58 name: "alpine@sha256:72af6266bafde8c78d5f20a2a85d0576533ce1ecd6ed8bcf7baf62a743f3b24d",
59 content: "FROM alpine@sha256:72af6266bafde8c78d5f20a2a85d0576533ce1ecd6ed8bcf7baf62a743f3b24d",
60 rng: protocol.Range{
61 Start: protocol.Position{Line: 0, Character: 0},
62 End: protocol.Position{Line: 0, Character: 16},
63 },
64 inlayHints: []protocol.InlayHint{},
65 },
66 {
67 name: "alpine:3.16@sha256:72af6266bafde8c78d5f20a2a85d0576533ce1ecd6ed8bcf7baf62a743f3b24d",
68 content: "FROM alpine:3.16@sha256:72af6266bafde8c78d5f20a2a85d0576533ce1ecd6ed8bcf7baf62a743f3b24d",
69 rng: protocol.Range{
70 Start: protocol.Position{Line: 0, Character: 0},
71 End: protocol.Position{Line: 0, Character: 16},
72 },
73 inlayHints: []protocol.InlayHint{},
74 },
75 {

Callers

nothing calls this directly

Calls 6

CreateBoolPointerFunction · 0.92
CreateAnyPointerFunction · 0.92
NewServiceFunction · 0.92
NewDockerfileDocumentFunction · 0.92
InlayHintFunction · 0.70
URIMethod · 0.65

Tested by

no test coverage detected