based tests
This commit is contained in:
28
aliases
28
aliases
@@ -20,7 +20,7 @@ cc-run(){
|
|||||||
cc-clean
|
cc-clean
|
||||||
}
|
}
|
||||||
|
|
||||||
cc-run-test(){
|
cc-run-test-inline(){
|
||||||
local file
|
local file
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "Usage: cc-run <file> [args...]" >&2
|
echo "Usage: cc-run <file> [args...]" >&2
|
||||||
@@ -43,6 +43,32 @@ cc-run-test(){
|
|||||||
cc-clean
|
cc-clean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc-run-test(){
|
||||||
|
local file
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: cc-run <file> [args...]" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cc-clean
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
# remove trailing .c if present
|
||||||
|
base="${file%.*}"
|
||||||
|
|
||||||
|
if command -v norminette &>/dev/null; then
|
||||||
|
norminette "${base}.c"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# compile base.test.c -> base.test.out and run it
|
||||||
|
cc -std=c99 "${base}.test.c" -o "${base}.test.out" -Wall -Wextra -Werror &&
|
||||||
|
"./${base}.test.out" "$@"
|
||||||
|
|
||||||
|
cc-clean
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cc-run-lax(){
|
cc-run-lax(){
|
||||||
local file
|
local file
|
||||||
|
|||||||
Reference in New Issue
Block a user