Fix the context parse test

Change-Id: I411916b4d4d62cd53d870299f2a415371ed644a3
This commit is contained in:
Jamie Gennis 2014-10-06 09:10:40 -07:00 committed by Colin Cross
parent 8762292240
commit 68540dab06

View file

@ -11,11 +11,9 @@ type fooModule struct {
} }
} }
var FooModule = MakeModuleType("FooModule", newFooModule) func newFooModule() (Module, []interface{}) {
func newFooModule() (Module, interface{}) {
m := &fooModule{} m := &fooModule{}
return m, &m.properties return m, []interface{}{&m.properties}
} }
func (f *fooModule) GenerateBuildActions(ModuleContext) { func (f *fooModule) GenerateBuildActions(ModuleContext) {
@ -31,11 +29,9 @@ type barModule struct {
} }
} }
var BarModule = MakeModuleType("BarModule", newBarModule) func newBarModule() (Module, []interface{}) {
func newBarModule() (Module, interface{}) {
m := &barModule{} m := &barModule{}
return m, &m.properties return m, []interface{}{&m.properties}
} }
func (b *barModule) GenerateBuildActions(ModuleContext) { func (b *barModule) GenerateBuildActions(ModuleContext) {
@ -47,8 +43,8 @@ func (b *barModule) Bar() bool {
func TestContextParse(t *testing.T) { func TestContextParse(t *testing.T) {
ctx := NewContext() ctx := NewContext()
ctx.RegisterModuleType("foo_module", FooModule) ctx.RegisterModuleType("foo_module", newFooModule)
ctx.RegisterModuleType("bar_module", BarModule) ctx.RegisterModuleType("bar_module", newBarModule)
r := bytes.NewBufferString(` r := bytes.NewBufferString(`
foo_module { foo_module {
@ -70,7 +66,7 @@ func TestContextParse(t *testing.T) {
t.FailNow() t.FailNow()
} }
errs = ctx.resolveDependencies() errs = ctx.resolveDependencies(nil)
if len(errs) > 0 { if len(errs) > 0 {
t.Errorf("unexpected dep errors:") t.Errorf("unexpected dep errors:")
for _, err := range errs { for _, err := range errs {