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

Function TestPrinterPrintStmtUseList

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

Source from the content-addressed store, hash-verified

4425}
4426
4427func TestPrinterPrintStmtUseList(t *testing.T) {
4428 o := bytes.NewBufferString("")
4429
4430 p := printer.NewPrinter(o)
4431 p.Print(&stmt.UseList{
4432 UseType: &node.Identifier{Value: "function"},
4433 Uses: []node.Node{
4434 &stmt.Use{
4435 Use: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
4436 Alias: &node.Identifier{Value: "Bar"},
4437 },
4438 &stmt.Use{
4439 Use: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}},
4440 },
4441 },
4442 })
4443
4444 expected := `use function Foo as Bar,Baz;`
4445 actual := o.String()
4446
4447 if expected != actual {
4448 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4449 }
4450}
4451
4452func TestPrinterPrintUse(t *testing.T) {
4453 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…