Skip to content

Commit

Permalink
tests: Combine cross-compile lifecycle BATS tests into one test
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Robinson committed Jul 27, 2022
1 parent 83481eb commit 60c87a0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/cross-compile.bats
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
#!/usr/bin/env bats

load './test_helpers/bats-support/load'
load './test_helpers/bats-assert/load'
load 'test_helpers/bats-support/load'
load 'test_helpers/bats-assert/load'

@test "clean out any cross compiled binaries" {
@test "test cross compilation command lifecycle" {
run make clean
assert_success
assert_output --partial 'rm -vRf ./builds/ahoy-bin-*'
}

@test "cross compile binaries with make" {
run ls ./builds/ahoy-*
assert_failure
assert_output --partial 'No such file'

run make cross
assert_success
assert_output --partial 'mv ./builds/ahoy-bin-windows-amd64 ./builds/ahoy-bin-windows-amd64.exe; mv ./builds/ahoy-bin-windows-arm64 ./builds/ahoy-bin-windows-arm64.exe;'
}

@test "check cross compiled binaries exist" {
run ls ./builds/ahoy-*
assert_output --partial 'ahoy-bin-darwin-amd64'
assert_output --partial 'ahoy-bin-linux-arm64'
assert_output --partial 'ahoy-bin-windows-amd64.exe'

run make clean
assert_success
assert_output --partial 'rm -vRf ./builds/ahoy-bin-*'

run ls ./builds/ahoy-*
assert_failure
assert_output --partial 'No such file'
}

0 comments on commit 60c87a0

Please sign in to comment.