func (*scriptSuite) TestWriteScriptWindows(c *gc.C) { renderer := &shell.PowershellRenderer{} script := ` exec a-command exec another-command ` commands := shell.WriteScript(renderer, "spam", `C:\ham\eggs`, strings.Split(script, "\n")) c.Check(commands, jc.DeepEquals, []string{ `Set-Content 'C:\ham\eggs\spam.ps1' @" exec a-command exec another-command "@`, }) }
func (*scriptSuite) TestWriteScriptUnix(c *gc.C) { renderer := &shell.BashRenderer{} script := ` exec a-command exec another-command ` commands := shell.WriteScript(renderer, "spam", "/ham/eggs", strings.Split(script, "\n")) cmd := ` cat > '/ham/eggs/spam.sh' << 'EOF' #!/usr/bin/env bash exec a-command exec another-command EOF`[1:] c.Check(commands, jc.DeepEquals, []string{ cmd, "chmod 0755 '/ham/eggs/spam.sh'", }) }