aboutsummaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2020-12-22 16:36:09 -0800
committerOmar Rizwan <omar@omar.website>2020-12-22 16:36:09 -0800
commitde9a792a2113ca48458d5142f2cd06353419793c (patch)
tree7131e9c79377f09a8f6ffedac56b6c2f17ccc365 /test.c
parent9e23fc59fc8fb3ee94aca07e2a2f7fa5d309df06 (diff)
start adding extensions/ folder. fix up js tests
some hacks to start working on clearing old scriptParsed entries
Diffstat (limited to 'test.c')
-rwxr-xr-xtest.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/test.c b/test.c
index a5f928e..38644c1 100755
--- a/test.c
+++ b/test.c
@@ -8,14 +8,14 @@
#include <assert.h>
int file_contents_equal(char* path, char* contents) {
- char command[200];
- snprintf(command, sizeof(command),
- "[ \"%s\" == \"$(cat %s)\" ]", contents, path);
- return system(command) == 0;
+ // hehe: https://twitter.com/ianh_/status/1340450349065244675
+ setenv("path", path, 1);
+ setenv("contents", contents, 1);
+ return system("[ \"$contents\" == \"$(cat \"$path\")\" ]") == 0;
}
// integration tests
-int main(int argc, char** argv) {
+int main() {
assert(system("echo about:blank > fs/mnt/tabs/create") == 0);
assert(file_contents_equal("fs/mnt/tabs/last-focused/url", "about:blank"));
assert(system("file fs/mnt/tabs/last-focused/screenshot.png") == 0);