2020-12-20 00:22:44 +01:00
|
|
|
//usr/bin/env cc -o test "$0" && ./test; exit
|
2020-12-20 00:36:22 +01:00
|
|
|
|
|
|
|
// (run this file directly with `./test.c` in most shells; if that
|
|
|
|
// doesn't work, run it with `sh test.c`)
|
|
|
|
|
2020-12-20 00:22:44 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2020-12-20 00:36:22 +01:00
|
|
|
int file_contents_equal(char* path, char* contents) {
|
|
|
|
char command[200];
|
|
|
|
snprintf(command, sizeof(command),
|
|
|
|
"[ \"%s\" == \"$(cat %s)\" ]", contents, path);
|
|
|
|
return system(command) == 0;
|
|
|
|
}
|
|
|
|
|
2020-12-20 00:22:44 +01:00
|
|
|
// integration tests
|
2020-12-20 02:11:59 +01:00
|
|
|
int main(int argc, char** argv) {
|
2020-12-20 00:22:44 +01:00
|
|
|
assert(system("echo about:blank > fs/mnt/tabs/create") == 0);
|
2020-12-20 00:36:22 +01:00
|
|
|
assert(file_contents_equal("fs/mnt/tabs/last-focused/url", "about:blank"));
|
|
|
|
assert(system("file fs/mnt/tabs/last-focused/screenshot.png") == 0);
|
2020-12-20 02:11:59 +01:00
|
|
|
assert(system("echo remove > fs/mnt/tabs/last-focused/control") == 0);
|
|
|
|
|
2020-12-20 00:22:44 +01:00
|
|
|
assert(1); printf("Done!\n");
|
|
|
|
}
|