diff options
author | Jaewoong Jung <gyias@users.noreply.github.com> | 2018-10-11 13:01:05 -0700 |
---|---|---|
committer | Dan Willemsen <dan@danw.org> | 2018-10-11 13:01:05 -0700 |
commit | ccc3494088ea4d4e020497ef489f15b6f3973596 (patch) | |
tree | 68e049df5e0331831cd0d0fa2ed28cd488363aa5 /context_test.go | |
parent | d127ba077b606f811db302b5eeb7f7d2448ee49c (diff) | |
download | android_build_blueprint-ccc3494088ea4d4e020497ef489f15b6f3973596.tar.gz android_build_blueprint-ccc3494088ea4d4e020497ef489f15b6f3973596.tar.bz2 android_build_blueprint-ccc3494088ea4d4e020497ef489f15b6f3973596.zip |
Make sure all modules have a name. (#226)
Throw an error if run into a module without a name when generating
contexts.
Test: context_test.go
Change-Id: I3976d86d1f15b8ac10a7a38aa42ae277740a8f3b
Diffstat (limited to 'context_test.go')
-rw-r--r-- | context_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/context_test.go b/context_test.go index bc21a1c..0d783dc 100644 --- a/context_test.go +++ b/context_test.go @@ -482,3 +482,29 @@ func TestWalkingWithSyntaxError(t *testing.T) { } } + +func TestParseFailsForModuleWithoutName(t *testing.T) { + ctx := NewContext() + ctx.MockFileSystem(map[string][]byte{ + "Blueprints": []byte(` + foo_module { + name: "A", + } + + bar_module { + deps: ["A"], + } + `), + }) + ctx.RegisterModuleType("foo_module", newFooModule) + ctx.RegisterModuleType("bar_module", newBarModule) + + _, errs := ctx.ParseBlueprintsFiles("Blueprints") + + expectedErrs := []error{ + errors.New(`Blueprints:6:4: property 'name' is missing from a module`), + } + if fmt.Sprintf("%s", expectedErrs) != fmt.Sprintf("%s", errs) { + t.Errorf("Incorrect errors; expected:\n%s\ngot:\n%s", expectedErrs, errs) + } +} |