🧪 Add simple test framework
Now that the project is finding a little adoption it is really high time to bring some tests into the code to ensure everything works as it should. This first version will only provide a simple test harness from which tests can slowly be written for other parts of the program.
This commit is contained in:
parent
edd5ebd743
commit
ceea79eb3a
5 changed files with 29 additions and 0 deletions
17
test/bemoji.bats
Normal file
17
test/bemoji.bats
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
setup() {
|
||||
load 'test_helper/bats-support/load'
|
||||
load 'test_helper/bats-assert/load'
|
||||
|
||||
# make bemoji executable from anywhere relative to current testfile
|
||||
TEST_DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
||||
PATH="$TEST_DIR/..:$PATH"
|
||||
}
|
||||
|
||||
@test "test can run script" {
|
||||
# closing FD3 manually to prevent hangs, see
|
||||
# https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs
|
||||
run bemoji 3>&-
|
||||
assert_success
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue