2 * Created on 29.02.2004
4 * To change the template for this generated file go to
5 * Window - Preferences - Java - Code Generation - Code and Comments
7 package net.sourceforge.phpeclipse.phpeditor.php.test;
9 import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest;
11 public class DualParseSyntaxErrorTest extends AbstractCompilerTest {
12 public static boolean optimizeStringLiterals = false;
14 public DualParseSyntaxErrorTest(String testName){
18 public void test01() {
21 "final class test {\n" +
23 "private function f1() {\n" +
26 "public function f2() {\n" +
32 String expectedSyntaxErrorDiagnosis =
35 String testName = "<test01>";
38 expectedSyntaxErrorDiagnosis);
41 public void test02() {
49 String expectedSyntaxErrorDiagnosis =
52 String testName = "<test02>";
55 expectedSyntaxErrorDiagnosis);
58 public void test03() {
60 "$chars = ( isset($HTTP_GET_VARS['chars']) ) ? intval($HTTP_GET_VARS['chars']) : 200;";
61 String expectedSyntaxErrorDiagnosis =
66 expectedSyntaxErrorDiagnosis);
69 public void test96() {
70 String s = "$str = <<<EOD\n" + "Example of string\n"
71 + "spanning multiple lines\n" + "using heredoc syntax.\n" + "EOD;\n"
72 + "\n" + "/* More complex example, with variables. */\n"
73 + "class foo\n" + "{\n" + " var $foo;\n" + " var $bar;\n" + "\n"
74 + " function foo()\n" + " {\n" + " $this->foo = 'Foo';\n"
75 + " $this->bar = array('Bar1', 'Bar2', 'Bar3');\n" + " }\n"
76 + "}\n" + "\n" + "$foo = new foo();\n" + "$name = 'MyName';\n" + "\n"
78 + "My name is \"$name\". I am printing some $foo->foo.\n"
79 + "Now, I am printing some {$foo->bar[1]}.\n"
80 + "This should print a capital 'A': \\x41\n" + "EOT;\n";
81 String expectedSyntaxErrorDiagnosis =
86 expectedSyntaxErrorDiagnosis);
89 public void test97() {
92 " function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n"+
97 String expectedSyntaxErrorDiagnosis =
102 expectedSyntaxErrorDiagnosis);
105 public void test98() {
108 "if(!$result = mysql_query($sql)) return(array());\n";
110 String expectedSyntaxErrorDiagnosis =
115 expectedSyntaxErrorDiagnosis);
119 public void test99() {
123 " function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n"+
128 String expectedSyntaxErrorDiagnosis =
130 "1. ERROR in (at line 1)\n" +
133 "Parser error \"\'public\' \'private\' or \'protected\' modifier expected for field declarations.\"\n" +
135 "2. ERROR in (at line 1)\n" +
138 "Parser error \"Too many closing \'}\'; end-of-file not reached.\"\n" +
143 expectedSyntaxErrorDiagnosis);