tests: Add main test file

This commit is contained in:
Dylan Araps 2018-05-18 14:35:31 +10:00
parent 5fb3ab6ee3
commit 92bf7da15a
4 changed files with 8 additions and 9 deletions

View file

@ -20,4 +20,4 @@ script:
# Check for lines longer than 100 chars.
# There are 3 lines that must be longer than 100 chars.
- if (("$(grep '.\{101\}' neofetch | wc -l)" > 3)); then (exit 1); else (exit 0); fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd tests; ./test_misc.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd tests && ./test.sh; fi

7
tests/test.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
#
# Run all tests.
./test_misc.sh
[[ -f /tmp/err ]] || exit 0 && { rm /tmp/err; exit 1; }

View file

@ -25,16 +25,8 @@ test_get_ppid() {
assert_equals "$result" "0"
}
test_get_process_name() {
result="$(get_process_name "1")"
assert_equals "$result" "systemd"
}
printf "%s\\n" "Test MISC functions."
test_convert_time
test_get_ppid
test_get_process_name
[[ -f /tmp/err ]] || exit 0 && { rm /tmp/err; exit 1; }

0
tests/test_util.sh Normal file → Executable file
View file