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

Function TestPrinterPrintStmtListNested

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

Source from the content-addressed store, hash-verified

4090}
4091
4092func TestPrinterPrintStmtListNested(t *testing.T) {
4093 o := bytes.NewBufferString("")
4094
4095 p := printer.NewPrinter(o)
4096 p.Print(&stmt.StmtList{
4097 Stmts: []node.Node{
4098 &stmt.Expression{Expr: &expr.Variable{
4099 VarName: &node.Identifier{Value: "a"},
4100 }},
4101 &stmt.StmtList{
4102 Stmts: []node.Node{
4103 &stmt.Expression{Expr: &expr.Variable{
4104 VarName: &node.Identifier{Value: "b"},
4105 }},
4106 &stmt.StmtList{
4107 Stmts: []node.Node{
4108 &stmt.Expression{Expr: &expr.Variable{
4109 VarName: &node.Identifier{Value: "c"},
4110 }},
4111 },
4112 },
4113 },
4114 },
4115 },
4116 })
4117
4118 expected := `{$a;{$b;{$c;}}}`
4119 actual := o.String()
4120
4121 if expected != actual {
4122 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4123 }
4124}
4125
4126func TestPrinterPrintStmtSwitch(t *testing.T) {
4127 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…