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

Function TestPrintShellExec

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

Source from the content-addressed store, hash-verified

1838}
1839
1840func TestPrintShellExec(t *testing.T) {
1841 o := bytes.NewBufferString("")
1842
1843 p := printer.NewPrettyPrinter(o, " ")
1844 p.Print(&expr.ShellExec{
1845 Parts: []node.Node{
1846 &scalar.EncapsedStringPart{Value: "hello "},
1847 &expr.Variable{VarName: &node.Identifier{Value: "world"}},
1848 &scalar.EncapsedStringPart{Value: "!"},
1849 },
1850 })
1851
1852 expected := "`hello {$world}!`"
1853 actual := o.String()
1854
1855 if expected != actual {
1856 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1857 }
1858}
1859
1860func TestPrintExprShortArray(t *testing.T) {
1861 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…