aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh12
-rwxr-xr-xscripts/test.sh18
2 files changed, 30 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..9458002
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+BUILD_DIR="build"
+SRC_DIR="."
+
+main() {
+ cmake -B "$BUILD_DIR" -S "$SRC_DIR" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+ cmake --build "$BUILD_DIR"
+}
+
+main "$@"
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 0000000..ea35ef7
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+main() {
+ echo "Running tests..."
+ local ctest_result=0
+ local bats_result=0
+
+ if ! (cd build && ctest --output-on-failure); then
+ ctest_result=1
+ fi
+ if ! ./tests/vendor/bats-core/bin/bats ./tests/justify.bats; then
+ bats_result=1
+ fi
+ exit $((ctest_result || bats_result))
+}
+
+main "$@"