fix: no collision when importing multiple packages with same name (#151)

Recompute import package names in each source file, to allow imported
package names to be scoped per file.
This commit is contained in:
Marc Vertes
2019-04-08 19:16:40 +02:00
committed by Ludovic Fernandez
parent 8910769b77
commit 543f3c7620
8 changed files with 48 additions and 6 deletions

View File

@@ -52,6 +52,7 @@ func runCheck(t *testing.T, p string) {
os.Stdout = w
i := interp.New()
i.Name = p
i.Use(interp.ExportValue)
i.Use(stdlib.Value)
@@ -60,7 +61,7 @@ func runCheck(t *testing.T, p string) {
if err == nil {
t.Fatalf("got nil error, want: %q", wanted)
}
if res := strings.TrimSpace(err.Error()); res != wanted {
if res := strings.TrimSpace(err.Error()); !strings.Contains(res, wanted) {
t.Errorf("got %q, want: %q", res, wanted)
}
return