MCPcopy
hub / github.com/hashicorp/go-getter / TestHgGetter_GetFile

Function TestHgGetter_GetFile

get_hg_test.go:98–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestHgGetter_GetFile(t *testing.T) {
99 if !testHasHg {
100 t.Log("hg not found, skipping")
101 t.Skip()
102 }
103 ctx := context.Background()
104
105 g := new(HgGetter)
106 dst := testing_helper.TempTestFile(t)
107 defer os.RemoveAll(filepath.Dir(dst))
108
109 req := &Request{
110 Dst: dst,
111 u: testModuleURL("basic-hg/foo.txt"),
112 }
113
114 // Download
115 if err := g.GetFile(ctx, req); err != nil {
116 t.Fatalf("err: %s", err)
117 }
118
119 // Verify the main file exists
120 if _, err := os.Stat(dst); err != nil {
121 t.Fatalf("err: %s", err)
122 }
123 testing_helper.AssertContents(t, dst, "Hello\n")
124}
125func TestHgGetter_HgArgumentsNotAllowed(t *testing.T) {
126 if !testHasHg {
127 t.Log("hg not found, skipping")

Callers

nothing calls this directly

Calls 3

testModuleURLFunction · 0.85
DirMethod · 0.65
GetFileMethod · 0.65

Tested by

no test coverage detected