aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/tst-lib.sh
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-10-15 18:19:25 +0500
committerEgor Tensin <egor@tensin.name>2026-10-15 18:19:25 +0500
commit1e1d21c2a2266eff74db9d46fa7efd073fb44677 (patch)
tree3fc8b8c5c1ed488dd4e0123b8093fc447f9471d9 /test/tst-lib.sh
parentdon't fail if lib/ doesn't exist (diff)
downloadtest-harness-1e1d21c2a2266eff74db9d46fa7efd073fb44677.tar.gz
test-harness-1e1d21c2a2266eff74db9d46fa7efd073fb44677.zip
add a couple of basic tests
Diffstat (limited to 'test/tst-lib.sh')
-rw-r--r--test/tst-lib.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/tst-lib.sh b/test/tst-lib.sh
new file mode 100644
index 0000000..8d7f876
--- /dev/null
+++ b/test/tst-lib.sh
@@ -0,0 +1,34 @@
+test_run() {
+ mkdir -- "$test_root_dir/lib"
+ cat > "$test_root_dir/lib/foo.sh" <<'EOF'
+test_foo() {
+ log foo
+}
+
+test_bar() {
+ log bar
+}
+EOF
+ cat > "$test_root_dir/lib/baz.sh" <<'EOF'
+test_baz() {
+ log baz
+}
+EOF
+
+ cat > "$test_root_dir/$test_file" <<'EOF'
+test_run() {
+ test_foo
+ test_bar
+ test_baz
+}
+EOF
+
+ local output
+ output="$( test_run_harness )"
+
+ test_check_harness_log "$output" "$test_file | foo"
+ test_check_harness_log "$output" "$test_file | bar"
+ test_check_harness_log "$output" "$test_file | baz"
+
+ test_check_harness_summary "$output" 1 0
+}