Expressions like:
[phpeclipse.git] / net.sourceforge.phpeclipse.tests / src / net / sourceforge / phpeclipse / tests / parser / PHPManualTestCase.java
index a32f03d..5d2c0b7 100644 (file)
@@ -19,16 +19,17 @@ public class PHPManualTestCase extends AbstractCompilerTest {
    * Test the PHP Parser with different PHP snippets
    */
   public void testPHPParser() {
-    checkPHP("if ((eregi(\"<[^>]*script*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*object*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*iframe*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*applet*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*meta*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*style*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"<[^>]*form*\\\"?[^>]*>\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"\\([^>]*\\\"?[^)]*\\)\", $secvalue)) ||\r\n" + 
-               "       (eregi(\"\\\"\", $secvalue))) {\r\n" + 
-               "   die (\"<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\\\"javascript:history.go(-1)\\\"><b>Go Back</b></a> ]\");\r\n" + 
+       checkPHP("self::$instance = new Singleton();");
+    checkPHP("if ((eregi(\"<[^>]*script*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*object*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*iframe*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*applet*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*meta*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*style*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"<[^>]*form*\\\"?[^>]*>\", $secvalue)) ||\r\n" +
+               "       (eregi(\"\\([^>]*\\\"?[^)]*\\)\", $secvalue)) ||\r\n" +
+               "       (eregi(\"\\\"\", $secvalue))) {\r\n" +
+               "   die (\"<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\\\"javascript:history.go(-1)\\\"><b>Go Back</b></a> ]\");\r\n" +
                "    }");
     checkPHP("function foo()" + "{" + "    echo \"In foo()<br>\\n\";" + "}"
         + "" + "function bar($arg = '')" + "{"
@@ -134,7 +135,7 @@ public class PHPManualTestCase extends AbstractCompilerTest {
         + "echo 'This will not expand: \\n a newline';\n" + "\n"
         + "// Outputs: Variables do not $expand $either\n"
         + "echo 'Variables do not $expand $either';\n");
-    
+
     checkPHP("echo \"This works: \" . $arr['foo'][3];");
     checkPHP("echo \"\\$foo==$foo; type is \" . gettype ($foo) . \"<br />\\n\";");
     checkPHP("$arr = array(\"foo\" => \"bar\", 12 => true);\n" + "\n"
@@ -204,11 +205,11 @@ public class PHPManualTestCase extends AbstractCompilerTest {
         + "echo $obj->scalar;  // outputs 'ciao'");
     checkPHP("$var = NULL;");
     checkPHP("$var = \"Bob\";\n" + "$Var = \"Joe\";\n"
-        + "echo \"$var, $Var\";      // outputs \"Bob, Joe\"\n" + "\n" + 
+        + "echo \"$var, $Var\";      // outputs \"Bob, Joe\"\n" + "\n" +
         //     "$4site = 'not yet'; // invalid; starts with a number\n" +
         "$_4site = 'not yet';    // valid; starts with an underscore\n"
         + "$täyte = 'mansikka';  \n");
-    checkPHP("");
+
     checkPHP("");
     checkPHP("");
   }