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

Function TestPrinterPrintStmtCase

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

Source from the content-addressed store, hash-verified

2855}
2856
2857func TestPrinterPrintStmtCase(t *testing.T) {
2858 o := bytes.NewBufferString("")
2859
2860 p := printer.NewPrinter(o)
2861 p.Print(&stmt.Case{
2862 Cond: &expr.Variable{
2863 VarName: &node.Identifier{Value: "a"},
2864 },
2865 Stmts: []node.Node{
2866 &stmt.Expression{Expr: &expr.Variable{
2867 VarName: &node.Identifier{Value: "a"},
2868 }},
2869 },
2870 })
2871
2872 expected := `case $a:$a;`
2873 actual := o.String()
2874
2875 if expected != actual {
2876 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2877 }
2878}
2879
2880func TestPrinterPrintStmtCaseEmpty(t *testing.T) {
2881 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…