summaryrefslogtreecommitdiff
path: root/test/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/test.c b/test/test.c
index d16c724..6f4537d 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,27 @@ 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);
+ }
+
+ {
+ assert(system("echo file://$(pwd)/test-textarea.html > ../fs/mnt/tabs/create") == 0);
+ {
+ FILE* console = fopen("../fs/mnt/tabs/last-focused/console", "r");
+ assert(system("echo \"console.log(document.getElementById('ta').value)\" > ../fs/mnt/tabs/last-focused/execute-script") == 0);
+
+ char ta[100] = {0}; fread(ta, 1, sizeof(ta), console);
+ assert(strcmp(ta, "initial text") == 0);
+
+ assert(file_contents_equal("../fs/mnt/tabs/last-focused/textareas/ta.txt", ta));
+
+ fclose(console);
+ }
assert(system("echo remove > ../fs/mnt/tabs/last-focused/control") == 0);
}