]> www.git.momoyon.org Git - commonlib.git/commitdiff
[test] New test 'shift_args.c'
authorahmedsamyh <ahmedsamyh10@gmail.com>
Tue, 25 Feb 2025 10:30:20 +0000 (15:30 +0500)
committerahmedsamyh <ahmedsamyh10@gmail.com>
Tue, 25 Feb 2025 10:30:24 +0000 (15:30 +0500)
tests/shift_args.c [new file with mode: 0644]
tests/shift_args.code.expected [new file with mode: 0644]
tests/shift_args.err.expected [new file with mode: 0644]
tests/shift_args.out.expected [new file with mode: 0644]

diff --git a/tests/shift_args.c b/tests/shift_args.c
new file mode 100644 (file)
index 0000000..73c6f6e
--- /dev/null
@@ -0,0 +1,12 @@
+#define COMMONLIB_IMPLEMENTATION
+#include "../commonlib.h"
+
+int main(int argc, char **argv) {
+    const char *program = c_shift_args(argv, argc);
+
+    printf("program: %s\n", program);
+    printf("After:\n");
+    printf("argc: %d\n", argc);
+    printf("argv: %s\n", argv[0]);
+    return 0;
+}
diff --git a/tests/shift_args.code.expected b/tests/shift_args.code.expected
new file mode 100644 (file)
index 0000000..c227083
--- /dev/null
@@ -0,0 +1 @@
+0
\ No newline at end of file
diff --git a/tests/shift_args.err.expected b/tests/shift_args.err.expected
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/shift_args.out.expected b/tests/shift_args.out.expected
new file mode 100644 (file)
index 0000000..3809763
--- /dev/null
@@ -0,0 +1,4 @@
+program: ./shift_args
+After:
+argc: 0
+argv: (null)