summaryrefslogtreecommitdiff
path: root/tests/std
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-30 00:34:33 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-30 00:34:33 +0000
commitb27b128f97596236a4ce6a3d9b40ef3dfad84d06 (patch)
tree00d17aeee6f84fb3641d0b84e1931f9a88649cac /tests/std
parentee090168fd7f678e40150b3699e335625b90d947 (diff)
New standard lib (std/process.zc).
Diffstat (limited to 'tests/std')
-rw-r--r--tests/std/test_process.zc26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/std/test_process.zc b/tests/std/test_process.zc
new file mode 100644
index 0000000..a3ba6ce
--- /dev/null
+++ b/tests/std/test_process.zc
@@ -0,0 +1,26 @@
+
+import "std/process.zc";
+import "std/string.zc";
+
+test "process output" {
+ let cmd = Command::new("echo");
+ cmd.arg("hello");
+
+ let out = cmd.output();
+
+ assert(out.exit_code == 0);
+ // echo usually outputs newline
+ assert(out.stdout.contains('h'));
+ assert(out.stdout.contains('e'));
+ assert(out.stdout.contains('l'));
+ assert(out.stdout.contains('o'));
+
+ // out is dropped automatically
+ // cmd is dropped automatically
+}
+
+test "process status" {
+ let cmd = Command::new("true"); // true command returns 0
+ let status = cmd.status();
+ assert(status == 0);
+}