public void ChildScope_Constructor_PopulatesParent() { MockScope parent = new MockScope(); TestChildScope childScope = new TestChildScope(parent); Assert.AreEqual(parent, childScope.Parent); }
public void ChildScope_Define_CallsParentDefine() { MockScope parent = new MockScope(); TestChildScope childScope = new TestChildScope(parent); childScope.Define(SymbolKindEnum.FUNCTION, "dummy", new ExprOp()); Assert.AreEqual(1, parent.DefineCalls.Count); }
public void ScopeExtensions_SearchScope_MakesReqursiveCallForChildScope() { MockScope parent = new MockScope(); ChildScope childScope = new TestChildScope(parent); MockScope result = ScopeExtensions.SearchScope <MockScope>(childScope); Assert.Equal(parent, result); }
public void ChildScope_Lookup_CallsParentLookup() { MockScope parent = new MockScope() { LookupResult = new ExprOp() }; TestChildScope childScope = new TestChildScope(parent); ExprOp result = childScope.Lookup(SymbolKindEnum.FUNCTION, "dummy"); Assert.AreEqual(1, parent.LookupCalls.Count); Assert.AreEqual(result, parent.LookupResult); }