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

Function TestPrintUse

printer/pretty_printer_test.go:4016–4032  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4014}
4015
4016func TestPrintUse(t *testing.T) {
4017 o := bytes.NewBufferString("")
4018
4019 p := printer.NewPrettyPrinter(o, " ")
4020 p.Print(&stmt.Use{
4021 UseType: &node.Identifier{Value: "function"},
4022 Use: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
4023 Alias: &node.Identifier{Value: "Bar"},
4024 })
4025
4026 expected := `function Foo as Bar`
4027 actual := o.String()
4028
4029 if expected != actual {
4030 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4031 }
4032}
4033
4034func TestPrintWhileStmtList(t *testing.T) {
4035 o := bytes.NewBufferString("")

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrettyPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…