(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestHgGetter_branch(t *testing.T) { |
| 57 | if !testHasHg { |
| 58 | t.Log("hg not found, skipping") |
| 59 | t.Skip() |
| 60 | } |
| 61 | ctx := context.Background() |
| 62 | |
| 63 | g := new(HgGetter) |
| 64 | dst := testing_helper.TempDir(t) |
| 65 | |
| 66 | url := testModuleURL("basic-hg") |
| 67 | q := url.Query() |
| 68 | q.Add("rev", "test-branch") |
| 69 | url.RawQuery = q.Encode() |
| 70 | |
| 71 | req := &Request{ |
| 72 | Dst: dst, |
| 73 | u: url, |
| 74 | } |
| 75 | |
| 76 | if err := g.Get(ctx, req); err != nil { |
| 77 | t.Fatalf("err: %s", err) |
| 78 | } |
| 79 | |
| 80 | // Verify the main file exists |
| 81 | mainPath := filepath.Join(dst, "main_branch.tf") |
| 82 | if _, err := os.Stat(mainPath); err != nil { |
| 83 | t.Fatalf("err: %s", err) |
| 84 | } |
| 85 | |
| 86 | // Get again should work |
| 87 | if err := g.Get(ctx, req); err != nil { |
| 88 | t.Fatalf("err: %s", err) |
| 89 | } |
| 90 | |
| 91 | // Verify the main file exists |
| 92 | mainPath = filepath.Join(dst, "main_branch.tf") |
| 93 | if _, err := os.Stat(mainPath); err != nil { |
| 94 | t.Fatalf("err: %s", err) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func TestHgGetter_GetFile(t *testing.T) { |
| 99 | if !testHasHg { |
nothing calls this directly
no test coverage detected