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

2960
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) 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) { func TestPlainHeredocScalarString(t *testing.T) {
src := `<? <<<CAD src := `<? <<<CAD
hello hello

View File

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