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

Function TestPrinterPrintWhileStmtList

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

Source from the content-addressed store, hash-verified

4468}
4469
4470func TestPrinterPrintWhileStmtList(t *testing.T) {
4471 o := bytes.NewBufferString("")
4472
4473 p := printer.NewPrinter(o)
4474 p.Print(&stmt.While{
4475 Cond: &expr.Variable{
4476 VarName: &node.Identifier{Value: "a"},
4477 },
4478 Stmt: &stmt.StmtList{
4479 Stmts: []node.Node{
4480 &stmt.Expression{Expr: &expr.Variable{
4481 VarName: &node.Identifier{Value: "a"},
4482 }},
4483 },
4484 },
4485 })
4486
4487 expected := `while($a){$a;}`
4488 actual := o.String()
4489
4490 if expected != actual {
4491 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4492 }
4493}

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…