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

Function TestPrinterPrintProperty

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

Source from the content-addressed store, hash-verified

3978}
3979
3980func TestPrinterPrintProperty(t *testing.T) {
3981 o := bytes.NewBufferString("")
3982
3983 p := printer.NewPrinter(o)
3984 p.Print(&stmt.Property{
3985 Variable: &expr.Variable{
3986 FreeFloating: freefloating.Collection{
3987 freefloating.Start: []freefloating.String{
3988 {
3989 StringType: freefloating.TokenType,
3990 Value: "$",
3991 },
3992 },
3993 },
3994 VarName: &node.Identifier{Value: "a"},
3995 },
3996 Expr: &scalar.Lnumber{Value: "1"},
3997 })
3998
3999 expected := `$a=1`
4000 actual := o.String()
4001
4002 if expected != actual {
4003 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4004 }
4005}
4006
4007func TestPrinterPrintReturn(t *testing.T) {
4008 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…