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

Function TestPrinterPrintNamespaceWithStmts

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

Source from the content-addressed store, hash-verified

3904}
3905
3906func TestPrinterPrintNamespaceWithStmts(t *testing.T) {
3907 o := bytes.NewBufferString("")
3908
3909 p := printer.NewPrinter(o)
3910 p.Print(&stmt.Namespace{
3911 NamespaceName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
3912 Stmts: []node.Node{
3913 &stmt.Expression{Expr: &expr.Variable{
3914 VarName: &node.Identifier{Value: "a"},
3915 }},
3916 },
3917 })
3918
3919 expected := `namespace Foo{$a;}`
3920 actual := o.String()
3921
3922 if expected != actual {
3923 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
3924 }
3925}
3926
3927func TestPrinterPrintNop(t *testing.T) {
3928 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…