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

Function TestPrinterPrintAltWhile

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

Source from the content-addressed store, hash-verified

2812}
2813
2814func TestPrinterPrintAltWhile(t *testing.T) {
2815 o := bytes.NewBufferString("")
2816
2817 p := printer.NewPrinter(o)
2818 p.Print(&stmt.AltWhile{
2819 Cond: &expr.Variable{
2820 VarName: &node.Identifier{Value: "a"},
2821 },
2822 Stmt: &stmt.StmtList{
2823 Stmts: []node.Node{
2824 &stmt.Expression{Expr: &expr.Variable{
2825 VarName: &node.Identifier{Value: "b"},
2826 }},
2827 },
2828 },
2829 })
2830
2831 expected := `while($a):$b;endwhile;`
2832 actual := o.String()
2833
2834 if expected != actual {
2835 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2836 }
2837}
2838
2839func TestPrinterPrintStmtBreak(t *testing.T) {
2840 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…