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

Function TestPrinterPrintStmtElseIfExpr

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

Source from the content-addressed store, hash-verified

3408}
3409
3410func TestPrinterPrintStmtElseIfExpr(t *testing.T) {
3411 o := bytes.NewBufferString("")
3412
3413 p := printer.NewPrinter(o)
3414 p.Print(&stmt.ElseIf{
3415 Cond: &expr.Variable{
3416 VarName: &node.Identifier{Value: "a"},
3417 },
3418 Stmt: &stmt.Expression{Expr: &scalar.String{Value: "'bar'"}},
3419 })
3420
3421 expected := `elseif($a)'bar';`
3422 actual := o.String()
3423
3424 if expected != actual {
3425 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
3426 }
3427}
3428
3429func TestPrinterPrintStmtElseIfNop(t *testing.T) {
3430 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…