yeezy taught me

This commit is contained in:
2019-09-23 07:53:24 -04:00
parent 7decc11933
commit 501f9fee97
6 changed files with 39 additions and 25 deletions
+6 -3
View File
@@ -1,15 +1,18 @@
#!/usr/bin/env bats
export BAKEFILE=args.Bakefile
@test "arguments don't work (set -u)" {
run bake -b args.Bakefile argv
run bake argv
[ "${status}" -eq 1 ]
}
@test "arguments do work [argv]" {
run bake --silent -b args.Bakefile argv 1 2 KEY=VALUE 3
run bake --silent argv 1 2 KEY=VALUE 3
[[ "${lines[0]}" == *"1 2 3"* ]]
}
@test "arguments do work [environ]" {
run bake --silent -b args.Bakefile argv 1 2 KEY=VALUE 3
run bake --silent argv 1 2 KEY=VALUE 3
[[ "${lines[1]}" == *"VALUE"* ]]
}
+15 -13
View File
@@ -1,58 +1,60 @@
#!/usr/bin/env bats
export BAKEFILE=basics.Bakefile
@test "bake --h" {
run bake -b basics.Bakefile --help
run bake --help
[ "${lines[0]}" = "Usage: [OPTIONS] [TASK] [ARGUMENTS]..." ]
}
@test "bake --help" {
run bake -b basics.Bakefile --help
run bake --help
[ "${lines[0]}" = "Usage: [OPTIONS] [TASK] [ARGUMENTS]..." ]
}
@test "bake --json" {
run bake -b basics.Bakefile --json
run bake --json
[ "${#lines[@]}" -eq 23 ]
}
@test "bake --json --levels 0" {
run bake -b basics.Bakefile --json --levels 0
run bake --json --levels 0
[ "${#lines[@]}" -eq 3 ]
}
@test "bake --levels 0" {
run bake -b basics.Bakefile --levels 0
run bake --levels 0
[ "${lines[0]}" = "" ]
}
@test "bake --levels 1" {
run bake -b basics.Bakefile --levels 1
run bake --levels 1
[ "${#lines[@]}" -eq 4 ]
}
@test "bake --levels 2" {
run bake -b basics.Bakefile --levels 3
run bake --levels 3
[ "${#lines[@]}" -eq 10 ]
}
@test "bake --levels 3" {
run bake -b basics.Bakefile --levels 3
run bake --levels 3
[ "${#lines[@]}" -eq 10 ]
}
@test "bake --levels 4" {
run bake -b basics.Bakefile --levels 4
run bake --levels 4
[ "${#lines[@]}" -eq 10 ]
}
@test "bake fails on 'exit 1'" {
run bake -b basics.Bakefile fail
run bake fail
[ "${status}" -eq 1 ]
}
@test "bake fails on subtask 'exit 1'" {
run bake -b basics.Bakefile deps/fail
run bake deps/fail
[ "${status}" -eq 1 ]
}
@@ -62,11 +64,11 @@
}
@test "bake runs sub-tasks" {
run bake -b basics.Bakefile echo/dep
run bake echo/dep
[ "${status}" -eq 0 ]
}
@test "bake --no-deps" {
run bake -b basics.Bakefile deps/fail --no-deps
run bake deps/fail --no-deps
[ "${status}" -eq 0 ]
}
+7 -4
View File
@@ -1,19 +1,22 @@
#!/usr/bin/env bats
export BAKEFILE=cache.Bakefile
@test "skips clear" {
bake -b cache.Bakefile --clear-skips
bake --clear-skips
}
@test "cache runs" {
run bake -b cache.Bakefile task
run bake task
[[ $output != *Skipping* ]]
}
@test "cache skips" {
run bake -b cache.Bakefile task
run bake task
[[ $output == *Skipping* ]]
}
@test "skip skips" {
run bake -b cache.Bakefile --no-deps task
run bake --no-deps task
[[ $output != *Skipping* ]]
}
+3 -1
View File
@@ -1,3 +1,5 @@
#!/usr/bin/env bats
export BAKEFILE=confirm.Bakefile
source ./_common.sh
@test "confirm works" {
@@ -5,7 +7,7 @@ source ./_common.sh
}
@test "confirm --yes works" {
bake -b confirm.Bakefile secure --yes
bake secure --yes
}
@test "confirm:secure works" {
+5 -3
View File
@@ -1,19 +1,21 @@
#!/usr/bin/env bats
export BAKEFILE=env.Bakefile
export HELLO=WORLD
@test "env cache clear" {
bake -b env.Bakefile --clear-envs env
bake --clear-envs env
}
@test "removal of environment untrusted variables" {
run bake -b env.Bakefile env
run bake env
[[ "${output}" != *HELLO=WORLD* ]]
}
@test "allowance of environment untrusted variables" {
run bake --allow HELLO
run bake -b env.Bakefile env
run bake env
[[ "${output}" == *"WORLD"* ]]
}
+3 -1
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env bats
export BAKEFILE=python.Bakefile
@test "python" {
run bake --silent -b python.Bakefile python
run bake --silent python
[[ "${lines[0]}" == "not bash" ]]
}