public void BreakStatementTest() { BreakStatement breakStmt = ParseUtilCSharp.ParseStatement <BreakStatement>("break;"); }
public void GotoDefaultStatementTest() { var gotoCaseStmt = ParseUtilCSharp.ParseStatement <GotoDefaultStatement>("goto default;"); }
public void GotoCaseStatementTest() { var gotoCaseStmt = ParseUtilCSharp.ParseStatement <GotoCaseStatement>("goto case 6;"); Assert.IsTrue(gotoCaseStmt.LabelExpression is PrimitiveExpression); }
public void StatementExpressionTest1() { ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement <ExpressionStatement>("yield.yield();"); Assert.IsTrue(stmtExprStmt.Expression is InvocationExpression); }
public void EmptyStatementTest() { EmptyStatement emptyStmt = ParseUtilCSharp.ParseStatement <EmptyStatement>(";"); }
public void YieldBreakStatementTest() { ParseUtilCSharp.ParseStatement <YieldBreakStatement>("yield break;"); }
public void ThrowStatementTest() { ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw new Exception();"); Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression); }
public void NestedArray() { VariableDeclarationStatement lvd = ParseUtilCSharp.ParseStatement <VariableDeclarationStatement>("DateTime[,][] a;"); Assert.IsTrue(new VariableDeclarationStatement(new SimpleType("DateTime").MakeArrayType(1).MakeArrayType(2), "a").IsMatch(lvd)); }
public void NestedPointers() { VariableDeclarationStatement lvd = ParseUtilCSharp.ParseStatement <VariableDeclarationStatement>("DateTime*** a;"); Assert.IsTrue(new VariableDeclarationStatement(new SimpleType("DateTime").MakePointerType().MakePointerType().MakePointerType(), "a").IsMatch(lvd)); }
public void ReturnStatementTest1() { ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement <ReturnStatement>("return yield;"); Assert.IsTrue(returnStatement.Expression is IdentifierExpression); }
public void NullableVariableDeclarationStatementTest1() { VariableDeclarationStatement lvd = ParseUtilCSharp.ParseStatement <VariableDeclarationStatement>("int? a;"); Assert.IsTrue(new VariableDeclarationStatement(new PrimitiveType("int").MakeNullableType(), "a").IsMatch(lvd)); }
public void ReturnStatementTest() { ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement <ReturnStatement>("return 5;"); Assert.IsTrue(returnStatement.Expression is PrimitiveExpression); }
public void EmptyReturnStatementTest() { ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement <ReturnStatement>("return;"); Assert.IsTrue(returnStatement.Expression.IsNull); }
public void UsingStatementTest() { UsingStatement usingStmt = ParseUtilCSharp.ParseStatement <UsingStatement>("using (MyVar var = new MyVar()) { } "); // TODO : Extend test. }
public void ContinueStatementTest() { ContinueStatement continueStmt = ParseUtilCSharp.ParseStatement <ContinueStatement>("continue;"); }
public void ArrayOfNullables() { VariableDeclarationStatement lvd = ParseUtilCSharp.ParseStatement <VariableDeclarationStatement>("DateTime?[] a;"); Assert.IsTrue(new VariableDeclarationStatement(new SimpleType("DateTime").MakeNullableType().MakeArrayType(), "a").IsMatch(lvd)); }
public void CheckedStatementTest() { CheckedStatement checkedStatement = ParseUtilCSharp.ParseStatement <CheckedStatement>("checked { }"); Assert.IsFalse(checkedStatement.Body.IsNull); }
public void VoidPointerVariableDeclarationTest() { VariableDeclarationStatement lvd = ParseUtilCSharp.ParseStatement <VariableDeclarationStatement>("void *a;"); Assert.IsTrue(new VariableDeclarationStatement(new PrimitiveType("void").MakePointerType(), "a").IsMatch(lvd)); }
public void EmptyThrowStatementTest() { ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw;"); Assert.IsTrue(throwStmt.Expression.IsNull); }
public void LockStatementTest() { LockStatement lockStmt = ParseUtilCSharp.ParseStatement <LockStatement>("lock (myObj) {}"); // TODO : Extend test. }
public void StatementExpressionTest() { ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement <ExpressionStatement>("a = my.Obj.PropCall;"); Assert.IsTrue(stmtExprStmt.Expression is AssignmentExpression); }
public void GotoStatementTest() { var gotoStmt = ParseUtilCSharp.ParseStatement <GotoStatement>("goto myLabel;"); Assert.AreEqual("myLabel", gotoStmt.Label); }
public void UnsafeStatementTest() { UnsafeStatement unsafeStatement = ParseUtilCSharp.ParseStatement <UnsafeStatement>("unsafe { }"); Assert.IsFalse(unsafeStatement.Body.IsNull); }
public void BlockStatementTest() { BlockStatement blockStmt = ParseUtilCSharp.ParseStatement <BlockStatement>("{}"); Assert.AreEqual(0, blockStmt.Statements.Count()); }