php5 test coverage

This commit is contained in:
z7zmey 2018-02-14 12:30:41 +02:00
parent 4cac863d8f
commit 6d714725bd
4 changed files with 1484 additions and 1411 deletions

10
diff
View File

@ -350,8 +350,12 @@
-350
-351
352
-353
354
-355
-356
357
-358
359
360
361
@ -364,6 +368,7 @@
368
369
370
-371
373
374
376
@ -435,11 +440,6 @@
528
-353
-355
-356
-358
-371
-372
-375
-377

2842
log

File diff suppressed because it is too large Load Diff

View File

@ -104,6 +104,26 @@ func TestMultilineSingleQuotedScalarString(t *testing.T) {
assertEqual(t, expected, actual)
}
func TestPlainHeredocEmptyString(t *testing.T) {
src := `<? <<<CAD
CAD;
`
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Expression{
Expr: &scalar.Encapsed{},
},
},
}
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
assertEqual(t, expected, actual)
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
assertEqual(t, expected, actual)
}
func TestPlainHeredocScalarString(t *testing.T) {
src := `<? <<<CAD
hello

View File

@ -55,6 +55,8 @@ func TestPhp5(t *testing.T) {
$test
';
<<<CAD
CAD;
<<<CAD
hello
CAD;
<<<"CAD"
@ -235,7 +237,7 @@ CAD;
eval($a);
exit;
exit($a);
die;
die();
die($a);
foo();
namespace\foo(&$a);
@ -267,7 +269,9 @@ CAD;
new \Foo();
print($a);
$a->foo;
` + "`cmd $a`;" + `
` + "`cmd $a`;" + `
` + "`cmd`;" + `
` + "``;" + `
[];
[1];
[1=>1, &$b,];
@ -486,6 +490,9 @@ CAD;
&stmt.Expression{
Expr: &scalar.String{Value: "'\n\t\t\t$test\n\t\t'"},
},
&stmt.Expression{
Expr: &scalar.Encapsed{},
},
&stmt.Expression{
Expr: &scalar.String{Value: "\thello\n"},
},
@ -2198,6 +2205,18 @@ CAD;
},
},
},
&stmt.Expression{
Expr: &expr.ShellExec{
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "cmd"},
},
},
},
&stmt.Expression{
Expr: &expr.ShellExec{
Parts: []node.Node{},
},
},
&stmt.Expression{
Expr: &expr.ShortArray{
Items: []node.Node{},