internal/core/eval: verify issue 398 is fixed

Fixes #398

Change-Id: Id7d8d4590f6bb531cb58ea4a176d33237c123fb2
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7044
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cmd/cue/cmd/testdata/script/issue398.txt b/cmd/cue/cmd/testdata/script/issue398.txt
new file mode 100644
index 0000000..53559ab
--- /dev/null
+++ b/cmd/cue/cmd/testdata/script/issue398.txt
@@ -0,0 +1,21 @@
+cue eval ./pkg:foo
+cmp stdout expect-stdout
+-- cue.mod/module.cue --
+module: "example.com"
+-- pkg/foo.cue --
+package foo
+import "example.com/pkg:bar"
+bar
+z: 3
+-- pkg/bar.cue --
+package bar
+import "example.com/pkg:baz"
+baz
+y: 2
+-- pkg/baz.cue --
+package baz
+x: 1
+-- expect-stdout --
+z: 3
+y: 2
+x: 1
diff --git a/cue/testdata/packages/issue398.txtar b/cue/testdata/packages/issue398.txtar
new file mode 100644
index 0000000..93bd039
--- /dev/null
+++ b/cue/testdata/packages/issue398.txtar
@@ -0,0 +1,31 @@
+-- cue.mod/module.cue --
+module: "example.com"
+-- foo.cue --
+package foo
+import "example.com/pkg:bar"
+bar
+zz: 3
+-- pkg/bar.cue --
+package bar
+import "example.com/pkg:baz"
+baz
+yy: 2
+-- pkg/baz.cue --
+package baz
+xx: 1
+-- out/eval --
+(struct){
+  foo: (struct){
+    x: (int){ 1 }
+    y: (int){ 2 }
+  }
+  zz: (int){ 3 }
+  x: (int){ 1 }
+  y: (int){ 2 }
+}
+-- out/compile --
+--- foo.cue
+{
+  〈import;"example.com/pkg:bar"〉
+  zz: 3
+}