Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsciple committed Nov 15, 2019
1 parent 386e9a2 commit 2cadc23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions packages/exec/__tests__/exec.test.ts
Expand Up @@ -146,7 +146,7 @@ describe('@actions/exec', () => {
exitCode = await exec.exec(tool, args, execOptions)

expect(exitCode).toBe(0)
let rootedTool = await io.which(tool, true)
const rootedTool = await io.which(tool, true)
expect(outStream.getContents().split(os.EOL)[0]).toBe(
`[command]${rootedTool} ${args.join(' ')}`
)
Expand Down Expand Up @@ -450,7 +450,7 @@ describe('@actions/exec', () => {
fs.unlinkSync(semaphorePath)
})

it('Runs exec roots relative tool path using unrooted options.cwd', async () => {
it('Exec roots relative tool path using unrooted options.cwd', async () => {
let exitCode: number
let command: string
if (IS_WINDOWS) {
Expand Down Expand Up @@ -482,7 +482,7 @@ describe('@actions/exec', () => {
const toolPath = path.resolve(__dirname, execOptions.cwd, command)
if (IS_WINDOWS) {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
`[command]${process.env.ComSpec} /D /S /C ""${toolPath}" hello world"`
`[command]${process.env.ComSpec} /D /S /C "${toolPath} hello world"`
)
} else {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
Expand All @@ -492,7 +492,7 @@ describe('@actions/exec', () => {
expect(output.trim()).toBe(`args[0]: "hello"${os.EOL}args[1]: "world"`)
})

it('Runs exec roots relative tool path using rooted options.cwd', async () => {
it('Exec roots relative tool path using rooted options.cwd', async () => {
let command: string
if (IS_WINDOWS) {
command = './print-args-cmd' // let ToolRunner resolve the extension
Expand All @@ -510,13 +510,13 @@ describe('@actions/exec', () => {
}
}

let exitCode = await exec.exec(`${command} hello world`, [], execOptions)
const exitCode = await exec.exec(`${command} hello world`, [], execOptions)

expect(exitCode).toBe(0)
const toolPath = path.resolve(__dirname, execOptions.cwd, command)
if (IS_WINDOWS) {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
`[command]${process.env.ComSpec} /D /S /C ""${toolPath}" hello world"`
`[command]${process.env.ComSpec} /D /S /C "${toolPath} hello world"`
)
} else {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
Expand All @@ -526,7 +526,7 @@ describe('@actions/exec', () => {
expect(output.trim()).toBe(`args[0]: "hello"${os.EOL}args[1]: "world"`)
})

it('Runs exec roots relative tool path using process.cwd', async () => {
it('Exec roots relative tool path using process.cwd', async () => {
let exitCode: number
let command: string
if (IS_WINDOWS) {
Expand Down Expand Up @@ -557,7 +557,7 @@ describe('@actions/exec', () => {
const toolPath = path.resolve(__dirname, command)
if (IS_WINDOWS) {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
`[command]${process.env.ComSpec} /D /S /C ""${toolPath}" hello world"`
`[command]${process.env.ComSpec} /D /S /C "${toolPath} hello world"`
)
} else {
expect(outStream.getContents().split(os.EOL)[0]).toBe(
Expand Down
16 changes: 8 additions & 8 deletions packages/exec/__tests__/scripts/print-args-sh.sh
@@ -1,11 +1,11 @@
#!/bin/bash
# store arguments in a special array
args=("$@")
# get number of elements
ELEMENTS=${#args[@]}
#!/usr/bin/env bash

# store arguments in a special array
args=("$@")
# get number of elements
ELEMENTS=${#args[@]}

# echo each element
for (( i=0;i<$ELEMENTS;i++)); do
for (( i=0;i<$ELEMENTS;i++)); do
echo "args[$i]: \"${args[${i}]}\""
done

0 comments on commit 2cadc23

Please sign in to comment.