@@ -25,6 +25,24 @@ func init() {
25
25
}
26
26
`
27
27
28
+ var expectedOutputOuter = `// Code generated by 'yaegi extract guthib.com/baz'. DO NOT EDIT.
29
+
30
+ package bar
31
+
32
+ import (
33
+ "github.com/traefik/yaegi/stdlib"
34
+ "guthib.com/baz"
35
+ "reflect"
36
+ )
37
+
38
+ func init() {
39
+ stdlib.Symbols["guthib.com/baz/baz"] = map[string]reflect.Value{
40
+ // function, constant and variable definitions
41
+ "Hello": reflect.ValueOf(baz.Hello),
42
+ }
43
+ }
44
+ `
45
+
28
46
func TestPackages (t * testing.T ) {
29
47
testCases := []struct {
30
48
desc string
@@ -35,6 +53,7 @@ func TestPackages(t *testing.T) {
35
53
expected string
36
54
contains string
37
55
dest string
56
+ outer bool
38
57
}{
39
58
{
40
59
desc : "stdlib math pkg, using go/importer" ,
@@ -51,6 +70,13 @@ func TestPackages(t *testing.T) {
51
70
arg : "../baz" ,
52
71
expected : expectedOutput ,
53
72
},
73
+ {
74
+ desc : "using relative path, using go.mod, out of stdlib" ,
75
+ wd : "./testdata/1/src/guthib.com/bar" ,
76
+ arg : "../baz" ,
77
+ outer : true ,
78
+ expected : expectedOutputOuter ,
79
+ },
54
80
{
55
81
desc : "using relative path, manual import path" ,
56
82
wd : "./testdata/2/src/guthib.com/bar" ,
@@ -149,7 +175,8 @@ func (W _guthib_com_variadic_Variadic) Call(method string, args ...[]interface{}
149
175
dest = test .dest
150
176
}
151
177
ext := Extractor {
152
- Dest : dest ,
178
+ Dest : dest ,
179
+ Outer : test .outer ,
153
180
}
154
181
155
182
var out bytes.Buffer
0 commit comments