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

Function TestGetDecoder

internal/pkg/document/document_test.go:94–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestGetDecoder(t *testing.T) {
95 testCases := []struct {
96 name string
97 content string
98 }{
99 {
100 name: "target {}",
101 content: "target {}",
102 },
103 }
104
105 for _, tc := range testCases {
106 t.Run(tc.name, func(t *testing.T) {
107 opts := WithReadDocumentFunc(func(uri.URI) ([]byte, error) {
108 return []byte(tc.content), nil
109 })
110 mgr := NewDocumentManager(opts)
111 document, err := mgr.Read(context.Background(), "docker-bake.hcl")
112 require.Nil(t, err)
113
114 hclDocument, ok := document.(BakeHCLDocument)
115 require.True(t, ok)
116 require.NotNil(t, hclDocument.Decoder())
117 })
118 }
119}
120
121func TestDocumentPath(t *testing.T) {
122 testCases := []struct {

Callers

nothing calls this directly

Calls 4

WithReadDocumentFuncFunction · 0.85
NewDocumentManagerFunction · 0.85
DecoderMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected