Example #1
0
func (self *BuildRule) setLocals(ns types.Namespace) {
	ns.Assign("TARGETS", self.targets)
	ns.Assign("SOURCES", self.sources)

	// these are really only meaningful for rules with one target or
	// one source... but such rules are pretty common, so these are
	// frequently handy
	ns.Assign("TARGET", self.targets.Nodes()[0])
	ns.Assign("SOURCE", self.sources.Nodes()[0])
}
Example #2
0
func assertIn(
	t *testing.T, ns types.Namespace, name string, expect types.FuObject) {
	if actual, ok := ns.Lookup(name); ok {
		if actual != expect {
			t.Errorf("expected %#v, but got %#v", expect, actual)
		}
	} else {
		t.Errorf("expected to find name '%s' in namespace", name)
	}
}