示例#1
0
 public void All_Tokens_Not_In_PHP_Open_Close_Tags_Returns_Html_Token()
 {
     TokenAssert.AreHtmlTokens(new string[] {
         "+", "&", "&&", "=", "``", ",", "//", "///", "/* comment */", "~",
         ".=", "--", "/=", "/", ";", "==", "@", ">", ">=", "===", "-"
     });
 }
示例#2
0
 public void Standard_Open_And_Close_Tags_Returns_OpenTag_And_CloseTag_Tokens()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?php" },
         { TokenType.CloseTag, "?>" }
     });
 }
示例#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, "?>" }
     });
 }
示例#4
0
 public void Equals_Sign_Returns_AssignmentOperator_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.WhiteSpace, " " },
         { TokenType.AssignmentOperator, "=" },
         { TokenType.CloseTag, "?>" }
     });
 }
示例#5
0
 public void Equals_Equals_Equals_Returns_IdenticalOperator_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.WhiteSpace, " " },
         { TokenType.IdenticalOperator, "===" },
         { TokenType.CloseTag, "?>" }
     });
 }
示例#6
0
 public void Three_Less_Thans_Returns_HereDocString_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" },
         { TokenType.HereDocString, "<<<EOT\nEOT" },
         { TokenType.EndOfStatement, ";" },
         { TokenType.CloseTag, "?>" }
     });
 }
示例#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, "?>" }
     });
 }
示例#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, "?>" }
     });
 }
示例#9
0
 public void Forward_Slash_Returns_DivisonOperator_Token()
 {
     TokenAssert.IsValid(TokenType.DivisionOperator, "/");
 }
示例#10
0
 public void Minus_Sign_Returns_SubtractionOperator_Token()
 {
     TokenAssert.IsValid(TokenType.SubtractionOperator, "-");
 }
示例#11
0
 public void Ampersand_Returns_Ampersand_Token()
 {
     TokenAssert.IsValid(TokenType.Ampersand, "&");
 }
示例#12
0
 public void Two_Backticks_Returns_BacktickString_Token()
 {
     TokenAssert.IsValid(TokenType.BacktickString, "``");
 }
示例#13
0
 public void Two_Ampersands_Returns_AndOperator_Token()
 {
     TokenAssert.IsValid(TokenType.AndOperator, "&&");
 }
示例#14
0
 public void Three_Slashes_Returns_Comment_Token()
 {
     TokenAssert.IsValid(TokenType.Comment, "///");
 }
示例#15
0
 public void Comma_Returns_Comma_Token()
 {
     TokenAssert.IsValid(TokenType.Comma, ",");
 }
示例#16
0
 public void Greater_Than_Returns_GreaterThanOperator_Token()
 {
     TokenAssert.IsValid(TokenType.GreaterThanOperator, ">");
 }
示例#17
0
 public void Greater_Than_Equals_Returns_GreaterThanOrEqualOperator_Token()
 {
     TokenAssert.IsValid(TokenType.GreaterThanOrEqualOperator, ">=");
 }
示例#18
0
 public void Plus_Sign_Returns_AdditionOperator_Token()
 {
     TokenAssert.IsValid(TokenType.AdditionOperator, "+");
 }
示例#19
0
 public void At_Symbol_Returns_ErrorSuppressor_Token()
 {
     TokenAssert.IsValid(TokenType.ErrorSuppressor, "@");
 }
示例#20
0
 public void Simple_Open_Tag_Returns_OpenTag_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?" }
     });
 }
示例#21
0
 public void Two_Minuses_Returns_Decrement_Operator_Token()
 {
     TokenAssert.IsValid(TokenType.DecrementOperator, "--");
 }
示例#22
0
 public void Period_Equals_Returns_ConcatEqualOperator_Token()
 {
     TokenAssert.IsValid(TokenType.ConcatEqualOperator, ".=");
 }
示例#23
0
 public void Tilde_Returns_ComplementOperator_Token()
 {
     TokenAssert.IsValid(TokenType.ComplementOperator, "~");
 }
示例#24
0
 public void Star_Slash_Returns_Comment_Token()
 {
     TokenAssert.IsValid(TokenType.Comment, "/* comment */");
 }
示例#25
0
 public void Standard_Open_Tag_Returns_OpenTag_Token()
 {
     TokenAssert.IsValid(new TokenPairs {
         { TokenType.OpenTag, "<?php" }
     });
 }
示例#26
0
 public void Semicolon_Returns_EndOfStatement_Token()
 {
     TokenAssert.IsValid(TokenType.EndOfStatement, ";");
 }