Last active
November 2, 2018 05:02
-
-
Save constrict0r/856f94478dc7faa74acf4d989d00a4cd to your computer and use it in GitHub Desktop.
Bats sample test file.
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
#!./test/libs/bats/bin/bats | |
load 'libs/bats-support/load' | |
load 'libs/bats-assert/load' | |
setup() { | |
VAR1=0 | |
} | |
@test "test setup function pass" { | |
[ $VAR1 -eq 0 ] | |
} | |
@test "test setup function fail" { | |
[ $VAR1 -eq 1 ] | |
} | |
@test "User is root" { | |
[ ! "$EUID" -ne 0 ] | |
} | |
@test "status var test pass" { | |
run echo "hello" | |
[ $status -eq 0 ] | |
} | |
@test "status var test fail" { | |
run echo "hello" | |
[ $status -eq 1 ] | |
} | |
@test "output var test pass" { | |
run echo "hello" | |
[ $output == "hello" ] | |
} | |
@test "output var test fail" { | |
run echo "hello" | |
[ $output == "hello2" ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment