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

Function TestPrinterPrintStmtConstList

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

Source from the content-addressed store, hash-verified

3125}
3126
3127func TestPrinterPrintStmtConstList(t *testing.T) {
3128 o := bytes.NewBufferString("")
3129
3130 p := printer.NewPrinter(o)
3131 p.Print(&stmt.ConstList{
3132 Consts: []node.Node{
3133 &stmt.Constant{
3134 ConstantName: &node.Identifier{Value: "FOO"},
3135 Expr: &scalar.String{Value: "'a'"},
3136 },
3137 &stmt.Constant{
3138 ConstantName: &node.Identifier{Value: "BAR"},
3139 Expr: &scalar.String{Value: "'b'"},
3140 },
3141 },
3142 })
3143
3144 expected := `const FOO='a',BAR='b';`
3145 actual := o.String()
3146
3147 if expected != actual {
3148 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
3149 }
3150}
3151
3152func TestPrinterPrintStmtConstant(t *testing.T) {
3153 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…