42 lines
673 B
Go
42 lines
673 B
Go
package module
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
var testHasHg bool
|
|
|
|
func init() {
|
|
if _, err := exec.LookPath("hg"); err == nil {
|
|
testHasHg = true
|
|
}
|
|
}
|
|
|
|
func TestHgGetter_impl(t *testing.T) {
|
|
var _ Getter = new(HgGetter)
|
|
}
|
|
|
|
func TestHgGetter(t *testing.T) {
|
|
if !testHasHg {
|
|
t.Log("hg not found, skipping")
|
|
t.Skip()
|
|
}
|
|
|
|
g := new(HgGetter)
|
|
dst := tempDir(t)
|
|
|
|
// With a dir that doesn't exist
|
|
if err := g.Get(dst, testModuleURL("basic-hg")); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
// Verify the main file exists
|
|
mainPath := filepath.Join(dst, "main.tf")
|
|
if _, err := os.Stat(mainPath); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|