mirror of
https://github.com/osnr/TabFS.git
synced 2024-05-21 06:56:36 +02:00
test: test test-page.html
This commit is contained in:
parent
5f15ab1c37
commit
44c8dfcec6
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
scratch
|
scratch
|
||||||
fs/tabfs
|
fs/tabfs
|
||||||
fs/tabfs.dSYM
|
fs/tabfs.dSYM
|
||||||
|
test/test
|
11
test/test-page.html
Normal file
11
test/test-page.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Title of Test Page</title>
|
||||||
|
<script src="test-script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Body Text of Test Page
|
||||||
|
</body>
|
||||||
|
</html>
|
1
test/test-script.js
Normal file
1
test/test-script.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
console.log('hello from test script!');
|
24
test/test.c
Executable file → Normal file
24
test/test.c
Executable file → Normal file
|
@ -1,8 +1,3 @@
|
||||||
//usr/bin/env cc -o test "$0" && ./test; exit
|
|
||||||
|
|
||||||
// (run this file directly with `./test.c` in most shells; if that
|
|
||||||
// doesn't work, run it with `sh test.c`)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -25,6 +20,7 @@ char* expand(char* phrase) { // expand path with wildcard
|
||||||
|
|
||||||
// integration tests
|
// integration tests
|
||||||
int main() {
|
int main() {
|
||||||
|
// if you don't have node, comment this out, I guess:
|
||||||
assert(system("node ../extension/background.js --unhandled-rejections=strict") == 0); // run quick local JS tests
|
assert(system("node ../extension/background.js --unhandled-rejections=strict") == 0); // run quick local JS tests
|
||||||
|
|
||||||
// reload the extension so we know it's the latest code.
|
// reload the extension so we know it's the latest code.
|
||||||
|
@ -34,11 +30,19 @@ int main() {
|
||||||
|
|
||||||
assert(file_contents_equal(expand("../fs/mnt/extensions/TabFS*/enabled"), "true"));
|
assert(file_contents_equal(expand("../fs/mnt/extensions/TabFS*/enabled"), "true"));
|
||||||
|
|
||||||
// FIXME: synthesize some kind of web page
|
{
|
||||||
assert(system("echo about:blank > ../fs/mnt/tabs/create") == 0);
|
assert(system("echo about:blank > ../fs/mnt/tabs/create") == 0);
|
||||||
// FIXME: race here
|
// FIXME: race here?
|
||||||
assert(file_contents_equal("../fs/mnt/tabs/last-focused/url.txt", "about:blank"));
|
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 remove > ../fs/mnt/tabs/last-focused/control") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
assert(system("echo file://$(pwd)/test-page.html > ../fs/mnt/tabs/create") == 0);
|
||||||
|
assert(file_contents_equal("../fs/mnt/tabs/last-focused/title.txt", "Title of Test Page"));
|
||||||
|
assert(file_contents_equal("../fs/mnt/tabs/last-focused/text.txt", "Body Text of Test Page"));
|
||||||
|
assert(system("echo remove > ../fs/mnt/tabs/last-focused/control") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
assert(1); printf("Done!\n");
|
assert(1); printf("Done!\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue