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

Function TestPrinterPrintShellExec

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

Source from the content-addressed store, hash-verified

2268}
2269
2270func TestPrinterPrintShellExec(t *testing.T) {
2271 o := bytes.NewBufferString("")
2272
2273 p := printer.NewPrinter(o)
2274 p.Print(&expr.ShellExec{
2275 Parts: []node.Node{
2276 &scalar.EncapsedStringPart{Value: "hello "},
2277 &expr.Variable{
2278 VarName: &node.Identifier{Value: "world"},
2279 },
2280 &scalar.EncapsedStringPart{Value: "!"},
2281 },
2282 })
2283
2284 expected := "`hello $world!`"
2285 actual := o.String()
2286
2287 if expected != actual {
2288 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2289 }
2290}
2291
2292func TestPrinterPrintExprShortArray(t *testing.T) {
2293 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…