private void AddIf(ICSharpTreeNode node, CompletionCase completionCase, IList <IStatement> body) { if (IsTargetMatch(node, completionCase)) { body.Add(EmptyCompletionExpression); } }
private bool IsTargetMatch(ICSharpTreeNode o, CompletionCase completionCase) { var isValid = _marker.HandlingNode != null; var isMatch = o == _marker.HandlingNode; var isRightCase = _marker.Case == completionCase; return(isValid && isMatch && isRightCase); }
protected void AssertCompletionMarker <TNodeType>(CompletionCase expectedCase) { var node = LastCompletionMarker.AffectedNode; if (!(node is TNodeType)) { Assert.Fail("expected {0}, but was {1}", typeof(TNodeType), node.GetType()); } Assert.AreEqual(expectedCase, LastCompletionMarker.Case); }
protected void AssertCompletionCase(CompletionCase expectedCase) { if (expectedCase != LastCompletionMarker.Case) { Assert.Fail( "Expected: {0}\nBut was {1}\n\nHandling node: {2}\n\n", expectedCase, LastCompletionMarker.Case, LastCompletionMarker.HandlingNode); } }
protected void AssertCompletionMarker(Type expectedType, CompletionCase expectedCase) { var actualCase = LastCompletionMarker.Case; var node = LastCompletionMarker.HandlingNode; if (node == null) { Assert.Fail( "expected {0} ({1}), but target node is null ({2})", expectedType, expectedCase, actualCase); } if (!expectedType.IsInstanceOfType(node)) { var actualType = node.GetType(); Assert.Fail( "expected {0} ({2}), but node type of target is {1} ({3})\n\nNode details:\n{4}\n\n", expectedType, actualType, expectedCase, actualCase, node); } if (expectedCase != actualCase) { Assert.Fail( "expected {0} ({1}). Node type is correct, but case is {2}.", expectedType, expectedCase, actualCase, node); } }
protected void AssertCompletionCase(CompletionCase expectedCase) { Assert.AreEqual(expectedCase, LastCompletionMarker.Case); }
public void Test_WithStatement(string body, CompletionCase expectedCase) { Exec(body + "\ncontinue;"); AssertCompletionCase(expectedCase); }
public void Test(string body, CompletionCase expectedCase) { Exec(body); AssertCompletionCase(expectedCase); }
protected void AssertCompletionMarker <TNodeType>(CompletionCase expectedCase) { var expectedType = typeof(TNodeType); AssertCompletionMarker(expectedType, expectedCase); }
public void Test_WithStatement(string body, Type expectedHandler, CompletionCase expectedCase) { Exec(body + "\ncontinue;"); AssertCompletionMarker(expectedHandler, expectedCase); }
public void Test(string body, Type expectedHandler, CompletionCase expectedCase) { Exec(body); AssertCompletionMarker(expectedHandler, expectedCase); }
public void UndefinedCases(string block, Type expectedType, CompletionCase expectedCase) { Console.WriteLine(block); CompleteInMethod(block); AssertCompletionMarker(expectedType, expectedCase); }