1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
|
//go:build !integration
// +build !integration
package shells
import (
"fmt"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-runner/common"
)
func TestPowershell_LineBreaks(t *testing.T) {
testCases := map[string]struct {
shell string
eol string
expectedErrorPreference string
shebang string
}{
"Windows newline on Desktop": {
shell: SNPowershell,
eol: "\r\n",
expectedErrorPreference: "",
},
"Windows newline on Core": {
shell: SNPwsh,
eol: "\r\n",
expectedErrorPreference: `$ErrorActionPreference = "Stop"` + "\r\n",
},
"Linux newline on Core": {
shell: SNPwsh,
eol: "\n",
shebang: `#!/usr/bin/env pwsh` + "\n",
expectedErrorPreference: `$ErrorActionPreference = "Stop"` + "\n",
},
}
for tn, tc := range testCases {
t.Run(tn, func(t *testing.T) {
eol := tc.eol
writer := &PsWriter{Shell: tc.shell, EOL: eol}
writer.Command("foo", "")
expectedOutput :=
tc.expectedErrorPreference +
`& "foo" ""` + eol + "if(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }" + eol +
eol +
eol
if tc.shell == SNPwsh {
expectedOutput = tc.shebang + "& {" + eol + eol + expectedOutput + "}" + eol + eol
} else {
expectedOutput = "\xef\xbb\xbf" + expectedOutput
}
assert.Equal(t, expectedOutput, writer.Finish(false))
})
}
}
func TestPowershell_CommandShellEscapes(t *testing.T) {
writer := &PsWriter{Shell: SNPowershell, EOL: "\r\n"}
writer.Command("foo", "x&(y)")
assert.Equal(
t,
"& \"foo\" \"x&(y)\"\r\nif(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }\r\n\r\n",
writer.String(),
)
}
func TestPowershell_IfCmdShellEscapes(t *testing.T) {
writer := &PsWriter{Shell: SNPowershell, EOL: "\r\n"}
writer.IfCmd("foo", "x&(y)")
//nolint:lll
assert.Equal(t, "Set-Variable -Name cmdErr -Value $false\r\nTry {\r\n & \"foo\" \"x&(y)\" 2>$null\r\n if(!$?) { throw &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }\r\n} Catch {\r\n Set-Variable -Name cmdErr -Value $true\r\n}\r\nif(!$cmdErr) {\r\n", writer.String())
}
func TestPowershell_MkTmpDirOnUNCShare(t *testing.T) {
writer := &PsWriter{TemporaryPath: `\\unc-server\share`, EOL: "\n"}
writer.MkTmpDir("tmp")
assert.Equal(
t,
`New-Item -ItemType directory -Force -Path "\\unc-server\share\tmp" | out-null`+writer.EOL,
writer.String(),
)
}
func TestPowershell_GetName(t *testing.T) {
for _, shellName := range []string{SNPwsh, SNPowershell} {
shell := common.GetShell(shellName)
assert.Equal(t, shellName, shell.GetName())
}
}
func TestPowershell_IsDefault(t *testing.T) {
for _, shellName := range []string{SNPwsh, SNPowershell} {
shell := common.GetShell(shellName)
assert.False(t, shell.IsDefault())
}
}
//nolint:lll
func TestPowershell_GetConfiguration(t *testing.T) {
testCases := map[string]struct {
shell string
executor string
user string
os string
expectedError error
expectedPassFile bool
expectedCommand string
expectedCmdLine string
getExpectedArguments func() []string
}{
"powershell on docker-windows": {
shell: SNPowershell,
executor: dockerWindowsExecutor,
expectedPassFile: false,
expectedCommand: SNPowershell,
getExpectedArguments: stdinCmdArgs,
expectedCmdLine: "powershell -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
},
"pwsh on docker-windows": {
shell: SNPwsh,
executor: dockerWindowsExecutor,
expectedPassFile: false,
expectedCommand: SNPwsh,
getExpectedArguments: stdinCmdArgs,
expectedCmdLine: "pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
},
"pwsh on docker": {
shell: SNPwsh,
executor: "docker",
expectedPassFile: false,
expectedCommand: SNPwsh,
getExpectedArguments: stdinCmdArgs,
expectedCmdLine: "pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
},
"pwsh on kubernetes": {
shell: SNPwsh,
executor: "kubernetes",
expectedPassFile: false,
expectedCommand: SNPwsh,
getExpectedArguments: stdinCmdArgs,
expectedCmdLine: "pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
},
"pwsh on shell": {
shell: SNPwsh,
executor: "shell",
expectedPassFile: false,
expectedCommand: SNPwsh,
getExpectedArguments: stdinCmdArgs,
expectedCmdLine: "pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
},
"powershell on shell": {
shell: SNPowershell,
executor: "shell",
expectedPassFile: true,
expectedCommand: SNPowershell,
getExpectedArguments: fileCmdArgs,
expectedCmdLine: "powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command",
},
"pwsh on shell with custom user (linux)": {
shell: SNPwsh,
executor: "shell",
user: "custom",
os: OSLinux,
expectedPassFile: false,
expectedCommand: "su",
expectedCmdLine: "su -s /usr/bin/pwsh custom -c pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
getExpectedArguments: func() []string {
return []string{"-s", "/usr/bin/" + SNPwsh, "custom", "-c", SNPwsh + " " + strings.Join(stdinCmdArgs(), " ")}
},
},
"pwsh on shell with custom user (windows)": {
shell: SNPwsh,
executor: "shell",
user: "custom",
os: OSWindows,
expectedPassFile: false,
expectedCommand: "su",
expectedCmdLine: "su custom -c pwsh -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -",
getExpectedArguments: func() []string {
return []string{"-s", "custom", "-c", SNPwsh + " " + strings.Join(stdinCmdArgs(), " ")}
},
},
"powershell docker-windows change user": {
shell: SNPowershell,
executor: "anything-but-docker-windows",
user: "custom",
expectedError: &powershellChangeUserError{
shell: SNPowershell,
executor: "anything-but-docker-windows",
},
},
}
for tn, tc := range testCases {
t.Run(tn, func(t *testing.T) {
if tc.os != "" && tc.os != runtime.GOOS {
t.Skipf("test only runs on %s", tc.os)
}
shell := common.GetShell(tc.shell)
info := common.ShellScriptInfo{
Shell: tc.shell,
User: tc.user,
Build: &common.Build{
Runner: &common.RunnerConfig{},
},
}
info.Build.Runner.Executor = tc.executor
shellConfig, err := shell.GetConfiguration(info)
if tc.expectedError != nil {
require.Equal(t, tc.expectedError, err)
return
}
require.NoError(t, err)
assert.Equal(t, tc.getExpectedArguments(), shellConfig.Arguments)
assert.Equal(t, tc.expectedCommand, shellConfig.Command)
assert.Equal(t, PowershellDockerCmd(tc.shell), shellConfig.DockerCommand)
assert.Equal(t, tc.expectedCmdLine, shellConfig.CmdLine)
assert.Equal(t, tc.expectedPassFile, shellConfig.PassFile)
assert.Equal(t, "ps1", shellConfig.Extension)
})
}
}
func TestPowershellCmdArgs(t *testing.T) {
for _, tc := range []string{SNPwsh, SNPowershell} {
t.Run(tc, func(t *testing.T) {
args := PowershellDockerCmd(tc)
assert.Equal(t, append([]string{tc}, stdinCmdArgs()...), args)
})
}
}
//nolint:lll
func TestPowershellPathResolveOperations(t *testing.T) {
testCases := map[string]struct {
op func(path string, w *PsWriter)
expected map[string]string
}{
"cd": {
op: func(path string, w *PsWriter) {
w.Cd(path)
},
expected: map[string]string{
`path/name`: "cd $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")\nif(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }\n\n",
`\\unc\`: "cd $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\\")\nif(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }\n\n",
`C:\path\`: "cd $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\\")\nif(!$?) { Exit &{if($LASTEXITCODE) {$LASTEXITCODE} else {1}} }\n\n",
},
},
"mkdir": {
op: func(path string, w *PsWriter) {
w.MkDir(path)
},
expected: map[string]string{
`path/name`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") | out-null\n",
`\\unc\`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\\") | out-null\n",
`C:\path\`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\\") | out-null\n",
},
},
"mktmpdir": {
op: func(path string, w *PsWriter) {
w.TemporaryPath = path
w.MkTmpDir("dir")
},
expected: map[string]string{
`path/name`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name/dir\") | out-null\n",
`\\unc\`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\/dir\") | out-null\n",
`C:\path\`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\/dir\") | out-null\n",
},
},
"rm": {
op: func(path string, w *PsWriter) {
w.RmFile(path)
},
expected: map[string]string{
`path/name`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -PathType Leaf) ) {\n Remove-Item2 -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")) {\n Remove-Item -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")\n}\n\n",
`\\unc\file`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -PathType Leaf) ) {\n Remove-Item2 -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")) {\n Remove-Item -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")\n}\n\n",
`C:\path\file`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -PathType Leaf) ) {\n Remove-Item2 -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")) {\n Remove-Item -Force $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")\n}\n\n",
},
},
"rmfilesrecursive": {
op: func(path string, w *PsWriter) {
w.RmFilesRecursive(path, "test")
},
expected: map[string]string{
`path/name`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -PathType Container) {\n Get-ChildItem -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -Filter \"test\" -Recurse | ForEach-Object { Remove-Item -Force $_.FullName }\n}\n",
`\\unc\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -PathType Container) {\n Get-ChildItem -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -Filter \"test\" -Recurse | ForEach-Object { Remove-Item -Force $_.FullName }\n}\n",
`C:\path\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -PathType Container) {\n Get-ChildItem -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -Filter \"test\" -Recurse | ForEach-Object { Remove-Item -Force $_.FullName }\n}\n",
},
},
"rmdir": {
op: func(path string, w *PsWriter) {
w.RmDir(path)
},
expected: map[string]string{
`path/name`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -PathType Container) ) {\n Remove-Item2 -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")) {\n Remove-Item -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\")\n}\n\n",
`\\unc\file`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -PathType Container) ) {\n Remove-Item2 -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")) {\n Remove-Item -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\")\n}\n\n",
`C:\path\file`: "if( (Get-Command -Name Remove-Item2 -Module NTFSSecurity -ErrorAction SilentlyContinue) -and (Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -PathType Container) ) {\n Remove-Item2 -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")\n} elseif(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")) {\n Remove-Item -Force -Recurse $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\")\n}\n\n",
},
},
"ifdirectory": {
op: func(path string, w *PsWriter) {
w.IfDirectory(path)
},
expected: map[string]string{
`path/name`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -PathType Container) {\n",
`\\unc\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -PathType Container) {\n",
`C:\path\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -PathType Container) {\n",
},
},
"iffile": {
op: func(path string, w *PsWriter) {
w.IfFile(path)
},
expected: map[string]string{
`path/name`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") -PathType Leaf) {\n",
`\\unc\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") -PathType Leaf) {\n",
`C:\path\file`: "if(Test-Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") -PathType Leaf) {\n",
},
},
"file variable": {
op: func(path string, w *PsWriter) {
w.TemporaryPath = path
w.Variable(common.JobVariable{File: true, Key: "a key", Value: "foobar"})
},
expected: map[string]string{
`path/name`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name\") | out-null\n[System.IO.File]::WriteAllText($ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name/a key\"), \"foobar\")\n$a key=$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"path/name/a key\")\n$env:a key=$a key\n",
`\\unc\file`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file\") | out-null\n[System.IO.File]::WriteAllText($ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file/a key\"), \"foobar\")\n$a key=$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"\\\\unc\\file/a key\")\n$env:a key=$a key\n",
`C:\path\file`: "New-Item -ItemType directory -Force -Path $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file\") | out-null\n[System.IO.File]::WriteAllText($ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file/a key\"), \"foobar\")\n$a key=$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(\"C:\\path\\file/a key\")\n$env:a key=$a key\n",
},
},
}
for tn, tc := range testCases {
for path, expected := range tc.expected {
for _, shell := range []string{SNPowershell, SNPwsh} {
t.Run(fmt.Sprintf("%s:%s: %s", shell, tn, path), func(t *testing.T) {
writer := &PsWriter{TemporaryPath: "\\temp", Shell: shell, EOL: "\n", resolvePaths: true}
tc.op(path, writer)
assert.Equal(t, expected, writer.String())
})
}
}
}
}
func TestPowershell_GenerateScript(t *testing.T) {
shellInfo := common.ShellScriptInfo{
Shell: "pwsh",
Type: common.NormalShell,
RunnerCommand: "/usr/bin/gitlab-runner-helper",
Build: &common.Build{
Runner: &common.RunnerConfig{},
},
}
shellInfo.Build.Runner.Executor = "kubernetes"
shellInfo.Build.Hostname = "Test Hostname"
pwshShell := common.GetShell("pwsh").(*PowerShell)
shebang := ""
if pwshShell.EOL == "\n" {
shebang = "#!/usr/bin/env pwsh\n"
}
testCases := map[string]struct {
stage common.BuildStage
info common.ShellScriptInfo
expectedFailure bool
expectedScript string
}{
"prepare script": {
stage: common.BuildStagePrepare,
info: shellInfo,
expectedFailure: false,
expectedScript: shebang + "& {" +
pwshShell.EOL + pwshShell.EOL +
`$ErrorActionPreference = "Stop"` + pwshShell.EOL +
`echo "Running on $([Environment]::MachineName) via "Test Hostname"..."` +
pwshShell.EOL + pwshShell.EOL + "}" + pwshShell.EOL + pwshShell.EOL,
},
"cleanup variables": {
stage: common.BuildStageCleanup,
info: shellInfo,
expectedFailure: false,
expectedScript: ``,
},
"no script": {
stage: "no_script",
info: shellInfo,
expectedFailure: true,
expectedScript: "",
},
}
for tn, tc := range testCases {
t.Run(tn, func(t *testing.T) {
script, err := pwshShell.GenerateScript(tc.stage, tc.info)
assert.Equal(t, tc.expectedScript, script)
if tc.expectedFailure {
assert.Error(t, err)
}
})
}
}
|