-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e47b6f9
commit 145eb30
Showing
4 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
function helloApp() { | ||
local messageFn=$1 | ||
local consoleFn=$2 | ||
$consoleFn "$($messageFn)" | ||
local messageFn=$1 | ||
local consoleFn=$2 | ||
$consoleFn "$($messageFn)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
function helloConsole() { | ||
local text=$1 | ||
echo "$text" | ||
local text=$1 | ||
echo "$text" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function helloMessage() { | ||
echo "Hello World!" | ||
echo "Hello World!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
setup() { | ||
load 'test_helper/bats-support/load' | ||
load 'test_helper/bats-assert/load' | ||
load 'test_helper/bats-support/load' | ||
load 'test_helper/bats-assert/load' | ||
|
||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" | ||
PATH="$DIR/../src:$PATH" | ||
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" | ||
PATH="$DIR/../src:$PATH" | ||
} | ||
|
||
@test "helloMessage should return hello world" { | ||
source hello-message.bash | ||
run helloMessage | ||
source hello-message.bash | ||
run helloMessage | ||
|
||
assert_output "Hello World!" | ||
assert_output "Hello World!" | ||
} | ||
|
||
@test "helloApp should print hello message" { | ||
function helloMessageMock() { | ||
echo "Hello Test!" | ||
} | ||
|
||
function helloConsoleMock() { | ||
local text=$1 | ||
echo "helloConsoleMock[$text]" | ||
} | ||
|
||
source hello-app.bash | ||
run helloApp helloMessageMock helloConsoleMock | ||
assert_output "helloConsoleMock[Hello Test!]" | ||
function helloMessageMock() { | ||
echo "Hello Test!" | ||
} | ||
|
||
function helloConsoleMock() { | ||
local text=$1 | ||
echo "helloConsoleMock[$text]" | ||
} | ||
|
||
source hello-app.bash | ||
run helloApp helloMessageMock helloConsoleMock | ||
|
||
assert_output "helloConsoleMock[Hello Test!]" | ||
} | ||
|
||
@test "hello.bash should print hello world" { | ||
run hello.bash | ||
run hello.bash | ||
|
||
assert_output "Hello World!" | ||
assert_output "Hello World!" | ||
} |