public void ExpressionStartWithShouldMatchAppropriateTokenList() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <SemiColonToken>()); IStatementExpression toMatch = _expression.StartsWith <SemiColonToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionContainsNoShouldMatchAppropriateTokenList() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); IStatementExpression toMatch = _expression.ContainsNo <SemiColonToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionStartWithShouldNotMatchUnAppropriateTokenList() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <SemiColonToken>()); input.Add(TokenCreator.Create <GenericToken>("content", null)); IStatementExpression toMatch = _expression.StartsWith <GenericToken>(); Assert.IsFalse(toMatch.Matches(input)); }
public void ExpressionEndsWithShouldMatchAppropriateTokenListIgnoringWhitespace() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <NewLineToken>()); input.Add(TokenCreator.Create <TabToken>()); IStatementExpression toMatch = _expression.EndsWith <PrivateModifierToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionIsShouldMatchSingleTokenTypeWithWhiteSpace() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <TabToken>()); input.Add(TokenCreator.Create <ClassToken>()); input.Add(TokenCreator.Create <SpaceToken>()); IStatementExpression toMatch = _expression.Is <ClassToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionIsShouldNotMatchDifferentTokenTypes() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <TabToken>()); input.Add(TokenCreator.Create <ClassToken>()); input.Add(TokenCreator.Create <IdentifierToken>("test")); input.Add(TokenCreator.Create <SpaceToken>()); IStatementExpression toMatch = _expression.Is <ClassToken>(); Assert.IsFalse(toMatch.Matches(input)); }
public void ExpressionIsShouldNotMatchMultipleInstancesOfSingleTokenType() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <TabToken>()); input.Add(TokenCreator.Create <ClassToken>()); input.Add(TokenCreator.Create <ClassToken>()); input.Add(TokenCreator.Create <SpaceToken>()); IStatementExpression toMatch = _expression.Is <ClassToken>(); Assert.IsFalse(toMatch.Matches(input)); }
public void ExpressionStartWithAndFollowedByStrictShouldNotIgnoreWhiteSpace() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <SemiColonToken>()); IStatementExpression toMatch = _expression.StartsWith <PrivateModifierToken>() .FollowedByStrict <SemiColonToken>(); Assert.IsFalse(toMatch.Matches(input)); }
public void ExpressionEndsWithShouldMatchAppropriateTokenList() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <IdentifierToken>("String")); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <IdentifierToken>("variable")); input.Add(TokenCreator.Create <SemiColonToken>()); IStatementExpression toMatch = _expression.EndsWith <SemiColonToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionStartWithAndFollowedByShouldMatchAppropriateTokenListIgnoringWhiteSpaceTokens() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <SpaceToken>()); input.Add(TokenCreator.Create <NewLineToken>()); input.Add(TokenCreator.Create <TabToken>()); input.Add(TokenCreator.Create <SemiColonToken>()); IStatementExpression toMatch = _expression.StartsWith <PrivateModifierToken>() .FollowedBy <SemiColonToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public void ExpressionShouldCheckEntireTokenListEvenIfFirstMatchWasInvalid() { IList <TokenBase> input = new List <TokenBase>(); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <IdentifierToken>("notvalid")); input.Add(TokenCreator.Create <SemiColonToken>()); input.Add(TokenCreator.Create <IdentifierToken>("identifier")); input.Add(TokenCreator.Create <PrivateModifierToken>()); input.Add(TokenCreator.Create <SemiColonToken>()); input.Add(TokenCreator.Create <IdentifierToken>("ending")); IStatementExpression toMatch = _expression.Contains <PrivateModifierToken>() .FollowedBy <SemiColonToken>(); Assert.IsTrue(toMatch.Matches(input)); }
public override void SetUp() { base.SetUp(); _expression = new StatementExpression(); }
public ExpressionStatement(IStatementParent parent, IStatementExpression expression) : base(parent) { this.Expression = expression; }