1
0
Fork 0
mirror of synced 2024-11-12 20:48:58 -05:00
yadm/test/100_accept_version.bats

26 lines
590 B
Text
Raw Normal View History

load common
load_fixtures
status=;output=; #; populated by bats run()
@test "Command 'version'" {
echo "
When 'version' command is provided,
2017-05-10 08:55:45 -04:00
Print the current version with format 'yadm x.x.x'
Exit with 0
"
#; run yadm with 'version' command
run "$T_YADM" version
# shellcheck source=/dev/null
#; load yadm variables (including VERSION)
YADM_TEST=1 source "$T_YADM"
#; validate status and output
[ $status -eq 0 ]
[ "$output" = "yadm $VERSION" ]
2017-05-10 08:55:45 -04:00
version_regex="^yadm [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$"
[[ "$output" =~ $version_regex ]]
}