(t *testing.T)
| 2268 | } |
| 2269 | |
| 2270 | func 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 | |
| 2292 | func TestPrinterPrintExprShortArray(t *testing.T) { |
| 2293 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…