From 41ce3a4dcf5a03588b7c350445e73975c6b12ff7 Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Sat, 18 Sep 2021 19:30:26 +0200
Subject: Add an actual unit-test for the execute function.

---
 test/execute_test.cc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 test/execute_test.cc

(limited to 'test')

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;
-- 
cgit v1.2.3