(t *testing.T)
| 4361 | } |
| 4362 | |
| 4363 | func TestPrinterPrintStmtTry(t *testing.T) { |
| 4364 | o := bytes.NewBufferString("") |
| 4365 | |
| 4366 | p := printer.NewPrinter(o) |
| 4367 | p.Print(&stmt.Try{ |
| 4368 | Stmts: []node.Node{ |
| 4369 | &stmt.Expression{Expr: &expr.Variable{ |
| 4370 | VarName: &node.Identifier{Value: "a"}, |
| 4371 | }}, |
| 4372 | }, |
| 4373 | Catches: []node.Node{ |
| 4374 | &stmt.Catch{ |
| 4375 | Types: []node.Node{ |
| 4376 | &name.Name{Parts: []node.Node{&name.NamePart{Value: "Exception"}}}, |
| 4377 | &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "RuntimeException"}}}, |
| 4378 | }, |
| 4379 | Variable: &expr.Variable{ |
| 4380 | VarName: &node.Identifier{Value: "e"}, |
| 4381 | }, |
| 4382 | Stmts: []node.Node{ |
| 4383 | &stmt.Expression{Expr: &expr.Variable{ |
| 4384 | VarName: &node.Identifier{Value: "b"}, |
| 4385 | }}, |
| 4386 | }, |
| 4387 | }, |
| 4388 | }, |
| 4389 | Finally: &stmt.Finally{ |
| 4390 | Stmts: []node.Node{ |
| 4391 | &stmt.Nop{}, |
| 4392 | }, |
| 4393 | }, |
| 4394 | }) |
| 4395 | |
| 4396 | expected := `try{$a;}catch(Exception|\RuntimeException$e){$b;}finally{;}` |
| 4397 | actual := o.String() |
| 4398 | |
| 4399 | if expected != actual { |
| 4400 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 4401 | } |
| 4402 | } |
| 4403 | |
| 4404 | func TestPrinterPrintStmtUnset(t *testing.T) { |
| 4405 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…