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

Function TestPrinterPrintStmtClassConstList

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

Source from the content-addressed store, hash-verified

3099}
3100
3101func TestPrinterPrintStmtClassConstList(t *testing.T) {
3102 o := bytes.NewBufferString("")
3103
3104 p := printer.NewPrinter(o)
3105 p.Print(&stmt.ClassConstList{
3106 Modifiers: []node.Node{&node.Identifier{Value: "public"}},
3107 Consts: []node.Node{
3108 &stmt.Constant{
3109 ConstantName: &node.Identifier{Value: "FOO"},
3110 Expr: &scalar.String{Value: "'a'"},
3111 },
3112 &stmt.Constant{
3113 ConstantName: &node.Identifier{Value: "BAR"},
3114 Expr: &scalar.String{Value: "'b'"},
3115 },
3116 },
3117 })
3118
3119 expected := `public const FOO='a',BAR='b';`
3120 actual := o.String()
3121
3122 if expected != actual {
3123 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
3124 }
3125}
3126
3127func TestPrinterPrintStmtConstList(t *testing.T) {
3128 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…