(t *testing.T)
| 4061 | } |
| 4062 | |
| 4063 | func TestPrintWhileExpression(t *testing.T) { |
| 4064 | o := bytes.NewBufferString("") |
| 4065 | |
| 4066 | p := printer.NewPrettyPrinter(o, " ") |
| 4067 | p.Print(&stmt.Namespace{ |
| 4068 | Stmts: []node.Node{ |
| 4069 | &stmt.While{ |
| 4070 | Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, |
| 4071 | Stmt: &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}}, |
| 4072 | }, |
| 4073 | }, |
| 4074 | }) |
| 4075 | |
| 4076 | expected := `namespace { |
| 4077 | while ($a) |
| 4078 | $a; |
| 4079 | }` |
| 4080 | actual := o.String() |
| 4081 | |
| 4082 | if expected != actual { |
| 4083 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 4084 | } |
| 4085 | } |
| 4086 | |
| 4087 | func TestPrintWhileNop(t *testing.T) { |
| 4088 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…