summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-09-18 19:30:26 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-09-18 19:30:26 +0200
commit41ce3a4dcf5a03588b7c350445e73975c6b12ff7 (patch)
tree8392bded2d40b293ed88d11a633e0325f8dcad14 /test
parentba04d2889a4e017c6043bac9951f722e60b63bc5 (diff)
Add an actual unit-test for the execute function.
Diffstat (limited to 'test')
-rw-r--r--test/execute_test.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/execute_test.cc b/test/execute_test.cc
new file mode 100644
index 0000000..e055757
--- /dev/null
+++ b/test/execute_test.cc
@@ -0,0 +1,23 @@
+#include <uunit.h>
+
+#include "../src/execute.h"
+
+class ExecuteTest
+ : public uUnit
+{
+public:
+ ExecuteTest()
+ {
+ uTEST(ExecuteTest::runit);
+ }
+
+ void runit()
+ {
+ uASSERT_EQUAL(0, execute("/bin/true", {}, false));
+ uASSERT_EQUAL(1, execute("/bin/false", {}, false));
+ uASSERT_EQUAL(1, execute("no-such-binary", {}, false));
+ }
+};
+
+// Registers the fixture into the 'registry'
+static ExecuteTest test;