(t *testing.T)
| 3534 | } |
| 3535 | |
| 3536 | func TestPrinterPrintStmtFor(t *testing.T) { |
| 3537 | o := bytes.NewBufferString("") |
| 3538 | |
| 3539 | p := printer.NewPrinter(o) |
| 3540 | p.Print(&stmt.For{ |
| 3541 | Init: []node.Node{ |
| 3542 | &expr.Variable{ |
| 3543 | VarName: &node.Identifier{Value: "a"}, |
| 3544 | }, |
| 3545 | &expr.Variable{ |
| 3546 | VarName: &node.Identifier{Value: "b"}, |
| 3547 | }, |
| 3548 | }, |
| 3549 | Cond: []node.Node{ |
| 3550 | &expr.Variable{ |
| 3551 | VarName: &node.Identifier{Value: "c"}, |
| 3552 | }, |
| 3553 | &expr.Variable{ |
| 3554 | VarName: &node.Identifier{Value: "d"}, |
| 3555 | }, |
| 3556 | }, |
| 3557 | Loop: []node.Node{ |
| 3558 | &expr.Variable{ |
| 3559 | VarName: &node.Identifier{Value: "e"}, |
| 3560 | }, |
| 3561 | &expr.Variable{ |
| 3562 | VarName: &node.Identifier{Value: "f"}, |
| 3563 | }, |
| 3564 | }, |
| 3565 | Stmt: &stmt.StmtList{ |
| 3566 | Stmts: []node.Node{ |
| 3567 | &stmt.Nop{}, |
| 3568 | }, |
| 3569 | }, |
| 3570 | }) |
| 3571 | |
| 3572 | expected := `for($a,$b;$c,$d;$e,$f){;}` |
| 3573 | actual := o.String() |
| 3574 | |
| 3575 | if expected != actual { |
| 3576 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 3577 | } |
| 3578 | } |
| 3579 | |
| 3580 | func TestPrinterPrintStmtForeach(t *testing.T) { |
| 3581 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…