compiler: allow to split main package across multiple files
This commit is contained in:
parent
553e57c2c4
commit
a34ba92d46
6 changed files with 63 additions and 33 deletions
|
@ -24,6 +24,20 @@ func TestCompiler(t *testing.T) {
|
|||
// CompileAndSave use config.Version for proper .nef generation.
|
||||
config.Version = "0.90.0-test"
|
||||
testCases := []compilerTestCase{
|
||||
{
|
||||
name: "TestCompileDirectory",
|
||||
function: func(t *testing.T) {
|
||||
const multiMainDir = "testdata/multi"
|
||||
_, di, err := compiler.CompileWithDebugInfo(multiMainDir, nil)
|
||||
require.NoError(t, err)
|
||||
m := map[string]bool{}
|
||||
for i := range di.Methods {
|
||||
m[di.Methods[i].Name.Name] = true
|
||||
}
|
||||
require.Contains(t, m, "Func1")
|
||||
require.Contains(t, m, "Func2")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "TestCompile",
|
||||
function: func(t *testing.T) {
|
||||
|
@ -73,10 +87,6 @@ func filterFilename(infos []os.FileInfo) string {
|
|||
}
|
||||
|
||||
func compileFile(src string) error {
|
||||
file, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = compiler.Compile("foo.go", file)
|
||||
_, err := compiler.Compile(src, nil)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue