summaryrefslogtreecommitdiffstats
path: root/testsuite/lib.test
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/lib.test')
-rw-r--r--testsuite/lib.test/fileutils.exp19
-rwxr-xr-xtestsuite/lib.test/fileutils_badfd.sh3
-rwxr-xr-xtestsuite/lib.test/fileutils_full.sh3
-rw-r--r--testsuite/lib.test/strutils.exp25
4 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/lib.test/fileutils.exp b/testsuite/lib.test/fileutils.exp
new file mode 100644
index 0000000..3eaf654
--- /dev/null
+++ b/testsuite/lib.test/fileutils.exp
@@ -0,0 +1,19 @@
+#
+# Testsuite for lib/fileutils program
+#
+
+set noarg "${topdir}src/tests/test_fileutils"
+
+set test "without argument"
+spawn $noarg
+expect_pass "$test" "Hello, World!"
+
+set badfd "${srcdir}/lib.test/fileutils_badfd.sh"
+set test "test bad file descriptor"
+spawn $badfd
+expect_pass "$test" "test_fileutils: write error: Bad file descriptor"
+
+set full "${srcdir}/lib.test/fileutils_full.sh"
+set test "test no space left on device"
+spawn $full
+expect_pass "$test" "test_fileutils: write error: No space left on device"
diff --git a/testsuite/lib.test/fileutils_badfd.sh b/testsuite/lib.test/fileutils_badfd.sh
new file mode 100755
index 0000000..12c5b83
--- /dev/null
+++ b/testsuite/lib.test/fileutils_badfd.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+${PWD}/../src/tests/test_fileutils >&-
diff --git a/testsuite/lib.test/fileutils_full.sh b/testsuite/lib.test/fileutils_full.sh
new file mode 100755
index 0000000..ea9b55a
--- /dev/null
+++ b/testsuite/lib.test/fileutils_full.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+${PWD}/../src/tests/test_fileutils > /dev/full
diff --git a/testsuite/lib.test/strutils.exp b/testsuite/lib.test/strutils.exp
new file mode 100644
index 0000000..72d1fcd
--- /dev/null
+++ b/testsuite/lib.test/strutils.exp
@@ -0,0 +1,25 @@
+#
+# Testsuite for lib/strutils program
+#
+
+set teststr "${topdir}src/tests/test_strutils"
+
+set test "without argument"
+spawn $teststr
+expect_pass "$test" "test_strutils: no arguments"
+
+set test "test long"
+spawn $teststr 1
+expect_pass "$test" "1"
+
+set test "test long fail"
+spawn $teststr fail
+expect_pass "$test" "test_strutils: strtol_or_err: \'fail\'"
+
+set test "test double"
+spawn $teststr dummy 1.1
+expect_pass "$test" "1.100000"
+
+set test "test double fail"
+spawn $teststr dummy fail
+expect_pass "$test" "test_strutils: strtod_or_err: \'fail\'"