MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestPrinterPrintAltElse

Function TestPrinterPrintAltElse

printer/printer_test.go:2616–2636  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2614}
2615
2616func TestPrinterPrintAltElse(t *testing.T) {
2617 o := bytes.NewBufferString("")
2618
2619 p := printer.NewPrinter(o)
2620 p.Print(&stmt.AltElse{
2621 Stmt: &stmt.StmtList{
2622 Stmts: []node.Node{
2623 &stmt.Expression{Expr: &expr.Variable{
2624 VarName: &node.Identifier{Value: "b"},
2625 }},
2626 },
2627 },
2628 })
2629
2630 expected := `else:$b;`
2631 actual := o.String()
2632
2633 if expected != actual {
2634 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2635 }
2636}
2637
2638func TestPrinterPrintAltElseEmpty(t *testing.T) {
2639 o := bytes.NewBufferString("")

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…