2014-09-14 02:45:56 +02:00
|
|
|
package module
|
|
|
|
|
|
|
|
import (
|
2014-09-14 03:54:12 +02:00
|
|
|
"io/ioutil"
|
2014-09-14 02:45:56 +02:00
|
|
|
"net/url"
|
2014-09-14 03:54:12 +02:00
|
|
|
"os"
|
2014-09-14 02:45:56 +02:00
|
|
|
"path/filepath"
|
2014-09-14 03:54:12 +02:00
|
|
|
"testing"
|
2014-09-14 02:45:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
const fixtureDir = "./test-fixtures"
|
|
|
|
|
2014-09-14 03:54:12 +02:00
|
|
|
func tempDir(t *testing.T) string {
|
|
|
|
dir, err := ioutil.TempDir("", "tf")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
if err := os.RemoveAll(dir); err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return dir
|
|
|
|
}
|
|
|
|
|
2014-09-14 02:45:56 +02:00
|
|
|
func testModule(n string) string {
|
|
|
|
p := filepath.Join(fixtureDir, n)
|
|
|
|
p, err := filepath.Abs(p)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
var url url.URL
|
|
|
|
url.Scheme = "file"
|
|
|
|
url.Path = p
|
|
|
|
return url.String()
|
|
|
|
}
|