Example #1
0
 public void All_Tokens_Not_In_PHP_Open_Close_Tags_Returns_Html_Token()
 {
     TokenAssert.AreHtmlTokens(new string[] {
         "+", "&", "&&", "=", "``", ",", "//", "///", "/* comment */", "~",
         ".=", "--", "/=", "/", ";", "==", "@", ">", ">=", "===", "-"
     });
 }
Example #2
0
 public void Standard_Open_And_Close_Tags_Returns_OpenTag_And_CloseTag_Tokens()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?php" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #3
0
 public void HereDoc_With_Other_Tokens_Returns_HereDocString_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.HereDocString, "<<<EOT\n//@\n'test'\"value\"<<<\nEOT" },
         { TokenType.WhiteSpace, "\n" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #4
0
 public void Equals_Sign_Returns_AssignmentOperator_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.WhiteSpace, " " },
         { TokenType.AssignmentOperator, "=" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #5
0
 public void Equals_Equals_Equals_Returns_IdenticalOperator_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.WhiteSpace, " " },
         { TokenType.IdenticalOperator, "===" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #6
0
 public void Three_Less_Thans_Returns_HereDocString_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.HereDocString, "<<<EOT\nEOT" },
         { TokenType.EndOfStatement, ";" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #7
0
 public void Print_Addition_Returns_Tokens()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?php" },
         { TokenType.WhiteSpace, " " },
         { TokenType.Identifier, "print" },
         { TokenType.LeftParenthesis, "(" },
         { TokenType.Number, "1" },
         { TokenType.AdditionOperator, "+" },
         { TokenType.Number, "2" },
         { TokenType.RightParenthesis, ")" },
         { TokenType.WhiteSpace, " " },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #8
0
 public void Basic_Ternary_Expression_Returns_Tokens()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.Identifier, "print" },
         { TokenType.LeftParenthesis, "(" },
         { TokenType.LeftParenthesis, "(" },
         { TokenType.Identifier, "true" },
         { TokenType.OrOperator, "||" },
         { TokenType.Identifier, "false" },
         { TokenType.RightParenthesis, ")" },
         { TokenType.TernaryOperator, "?" },
         { TokenType.String, "'yay'" },
         { TokenType.TernaryOperator, ":" },
         { TokenType.String, "'nay'" },
         { TokenType.RightParenthesis, ")" },
         { TokenType.EndOfStatement, ";" },
         { TokenType.CloseTag, "?>" }
     });
 }
Example #9
0
 public void Forward_Slash_Returns_DivisonOperator_Token()
 {
     TokenAssert.IsValid(TokenType.DivisionOperator, "/");
 }
Example #10
0
 public void Minus_Sign_Returns_SubtractionOperator_Token()
 {
     TokenAssert.IsValid(TokenType.SubtractionOperator, "-");
 }
Example #11
0
 public void Ampersand_Returns_Ampersand_Token()
 {
     TokenAssert.IsValid(TokenType.Ampersand, "&");
 }
Example #12
0
 public void Two_Backticks_Returns_BacktickString_Token()
 {
     TokenAssert.IsValid(TokenType.BacktickString, "``");
 }
Example #13
0
 public void Two_Ampersands_Returns_AndOperator_Token()
 {
     TokenAssert.IsValid(TokenType.AndOperator, "&&");
 }
Example #14
0
 public void Three_Slashes_Returns_Comment_Token()
 {
     TokenAssert.IsValid(TokenType.Comment, "///");
 }
Example #15
0
 public void Comma_Returns_Comma_Token()
 {
     TokenAssert.IsValid(TokenType.Comma, ",");
 }
Example #16
0
 public void Greater_Than_Returns_GreaterThanOperator_Token()
 {
     TokenAssert.IsValid(TokenType.GreaterThanOperator, ">");
 }
Example #17
0
 public void Greater_Than_Equals_Returns_GreaterThanOrEqualOperator_Token()
 {
     TokenAssert.IsValid(TokenType.GreaterThanOrEqualOperator, ">=");
 }
Example #18
0
 public void Plus_Sign_Returns_AdditionOperator_Token()
 {
     TokenAssert.IsValid(TokenType.AdditionOperator, "+");
 }
Example #19
0
 public void At_Symbol_Returns_ErrorSuppressor_Token()
 {
     TokenAssert.IsValid(TokenType.ErrorSuppressor, "@");
 }
Example #20
0
 public void Simple_Open_Tag_Returns_OpenTag_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" }
     });
 }
Example #21
0
 public void Two_Minuses_Returns_Decrement_Operator_Token()
 {
     TokenAssert.IsValid(TokenType.DecrementOperator, "--");
 }
Example #22
0
 public void Period_Equals_Returns_ConcatEqualOperator_Token()
 {
     TokenAssert.IsValid(TokenType.ConcatEqualOperator, ".=");
 }
Example #23
0
 public void Tilde_Returns_ComplementOperator_Token()
 {
     TokenAssert.IsValid(TokenType.ComplementOperator, "~");
 }
Example #24
0
 public void Star_Slash_Returns_Comment_Token()
 {
     TokenAssert.IsValid(TokenType.Comment, "/* comment */");
 }
Example #25
0
 public void Standard_Open_Tag_Returns_OpenTag_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?php" }
     });
 }
Example #26
0
 public void Semicolon_Returns_EndOfStatement_Token()
 {
     TokenAssert.IsValid(TokenType.EndOfStatement, ";");
 }