Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xmas 2022 updates #55

Merged
Prev Previous commit
Next Next commit
trying out variations of test.bats to get it working
  • Loading branch information
Frank Peng committed Dec 28, 2022
commit b63cd7f6c448826840e4fa02601a595687787823
34 changes: 31 additions & 3 deletions tests/test-plugin/tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,41 @@ load "$BATS_PLUGIN_PATH/load.bash"
# export FOO_STUB_DEBUG=/dev/tty

@test "bats works AOK" {
echo "AOK"
run bash -c "echo 'AOK'"
assert_success
}

@test "bats-mock works" {
stub foo "bar : echo baz"
foo bar
stub foo \
"bar : echo baz"
run foo bar
assert_success
unstub foo
}

# # @test 'assert_success() status only' {
# # run bash -c "echo 'Error!'; exit 1"
# # assert_success
# # }

# # @test 'assert_failure() status only' {
# # run echo 'Success!'
# # assert_failure
# # }

# @test 'assert success' {
# run bash -c "echo 'this'"
# assert_success
# }

@test "echoing" {
run echo "AOK"
assert_success
}

@test "stubbing" {
stub greet "sayhi: echo hello"
run greet sayhi
assert_success
unstub greet
}