diff options
author | Omar Rizwan <omar.rizwan@gmail.com> | 2021-01-12 00:15:25 -0800 |
---|---|---|
committer | Omar Rizwan <omar.rizwan@gmail.com> | 2021-01-12 00:15:25 -0800 |
commit | 8b0e106ebdce0020a3b7863061feb6a3eabe0c3f (patch) | |
tree | cc225ac93e2341e986184483c0e5d77125dd79d5 /test | |
parent | a7ab34ebbce60f2af159f9010a2e3629756af3d1 (diff) |
test: add test for #40
Diffstat (limited to 'test')
-rw-r--r-- | test/test.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/test.c b/test/test.c index d16c724..aaff360 100644 --- a/test/test.c +++ b/test/test.c @@ -13,7 +13,7 @@ int file_contents_equal(char* path, char* contents) { // hehe: https://twitter.com/ianh_/status/1340450349065244675 setenv("path", path, 1); setenv("contents", contents, 1); - return system("[ \"$contents\" == \"$(cat \"$path\")\" ]") == 0; + return system("bash -c '[ \"$contents\" == \"$(cat \"$path\")\" ]'") == 0; } char* expand(char* phrase) { // expand path with wildcard @@ -77,7 +77,11 @@ int main() { assert(strcmp(hi, "hi") == 0); fclose(console); } - + + // try to shorten the URL (#40) + assert(system("echo about:blank > ../fs/mnt/tabs/last-focused/url.txt") == 0); + assert(file_contents_equal("../fs/mnt/tabs/last-focused/url.txt", "about:blank")); + assert(system("echo remove > ../fs/mnt/tabs/last-focused/control") == 0); } |