Skip to content

Commit

Permalink
refactor: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
looztra committed Aug 25, 2024
1 parent 2f5fa44 commit b061b1d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/os_specific.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bats
# shellcheck disable=SC2034
BATS_TEST_FILENAME_BASENAME=$(basename "${BATS_TEST_FILENAME}")
# bats file_tags=type:os_specific

load '../lib/utils.bash'

@test "get_cpu on linux and version <= 0.26.7 [${BATS_TEST_FILENAME_BASENAME}]" {
if [[ "$OSTYPE" == "darwin"* ]] && [[ "$(uname -m)" == "arm64" ]]; then
skip "Skipping test on darwin/arm64"
fi
cpu=$(get_cpu "0.25.7")
[ "${cpu}" == "x86_64" ]
}

@test "get_cpu on linux and version > 0.26.7 [${BATS_TEST_FILENAME_BASENAME}]" {
if [[ "$OSTYPE" == "darwin"* ]] && [[ "$(uname -m)" == "arm64" ]]; then
skip "Skipping test on darwin/arm64"
fi
cpu=$(get_cpu "0.26.0")
[ "${cpu}" == "amd64" ]
}

@test "get_cpu on darwin and version <= 0.26.7 [${BATS_TEST_FILENAME_BASENAME}]" {
if [[ "$OSTYPE" != "darwin"* ]] && [[ "$(uname -m)" != "arm64" ]]; then
skip "Skipping test as not darwin/arm64"
fi
cpu=$(get_cpu "0.25.7")
[ "${cpu}" == "arm64" ]
}

@test "get_cpu on darwin and version > 0.26.7 [${BATS_TEST_FILENAME_BASENAME}]" {
if [[ "$OSTYPE" != "darwin"* ]] && [[ "$(uname -m)" != "arm64" ]]; then
skip "Skipping test as not darwin/arm64"
fi
cpu=$(get_cpu "0.26.0")
[ "${cpu}" == "arm64" ]
}

0 comments on commit b061b1d

Please sign in to comment.