-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from jaytaph/test-fixes
Fixed tests so they run correctly now
- Loading branch information
Showing
5 changed files
with
97 additions
and
24 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.SILENT: | ||
|
||
SHELL=/usr/bin/env bash -O globstar | ||
|
||
all: help | ||
|
||
test: test_unit test_clippy test_fmt ## Runs tests | ||
|
||
build: ## Build the project | ||
source test-utils.sh ;\ | ||
section "Cargo build" ;\ | ||
cargo build | ||
|
||
test_unit: | ||
source test-utils.sh ;\ | ||
section "Cargo test" ;\ | ||
cargo test | ||
|
||
test_clippy: | ||
source test-utils.sh ;\ | ||
section "Cargo clippy" ;\ | ||
cargo clippy -- -D warnings | ||
|
||
test_fmt: | ||
source test-utils.sh ;\ | ||
section "Cargo fmt" ;\ | ||
cargo fmt -- --check | ||
|
||
help: ## Display available commands | ||
echo "Available make commands:" | ||
echo | ||
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
# Simple test utils for bash scripts | ||
|
||
reset="\e[0m" | ||
expand="\e[K" | ||
|
||
notice="\e[1;33;44m" | ||
success="\e[1;33;42m" | ||
fail="\e[1;33;41m" | ||
|
||
function section() { | ||
SECTION=$1 | ||
echo -e "\n" | ||
echo -e "${notice} $1 ${expand}${reset}" | ||
echo -e "\n" | ||
} | ||
|
||
function status() { | ||
RC=$? | ||
if [ "$RC" == "0" ] ; then | ||
echo -e "\n" | ||
echo -e "${success} ${expand}${reset}" | ||
echo -e "${success} SUCCESS: ${SECTION} ${expand}${reset}" | ||
echo -e "${success} ${expand}${reset}" | ||
echo -e "\n" | ||
echo -e "\n" | ||
else | ||
echo -e "\n" | ||
echo -e "${fail} ${expand}${reset}" | ||
echo -e "${fail} ERROR($RC): ${SECTION} ${expand}${reset}" | ||
echo -e "${fail} ${expand}${reset}" | ||
echo -e "\n" | ||
echo -e "\n" | ||
fi | ||
} | ||
|
||
trap "status" EXIT |