forked from cory/tildefriends
cleanup: Remove server-side JS socket and HTTP request support. Not used/useful enough to justify keeping all this code around.
This commit is contained in:
88
src/tests.c
88
src/tests.c
@@ -549,93 +549,6 @@ static void _test_float(const tf_test_options_t* options)
|
||||
unlink("out/child.js");
|
||||
}
|
||||
|
||||
static void _test_socket(const tf_test_options_t* options)
|
||||
{
|
||||
_write_file("out/test.js",
|
||||
"'use strict';\n"
|
||||
"\n"
|
||||
"var s = new Socket();\n"
|
||||
"print('connecting');\n"
|
||||
"print('before connect', s.isConnected);\n"
|
||||
"s.onError(function(e) {\n"
|
||||
" print(e);\n"
|
||||
"});\n"
|
||||
"print('noDelay', s.noDelay);\n"
|
||||
"s.noDelay = true;\n"
|
||||
"s.connect('www.unprompted.com', 80).then(function() {\n"
|
||||
" print('connected', 'www.unprompted.com', 80, s.isConnected);\n"
|
||||
" print(s.peerName);\n"
|
||||
" s.read(function(data) {\n"
|
||||
" print('read', data ? data.length : null);\n"
|
||||
" });\n"
|
||||
" s.write('GET / HTTP/1.0\\r\\n\\r\\n');\n"
|
||||
"}).then(function(e) {\n"
|
||||
" print('closed 1');\n"
|
||||
"});\n"
|
||||
"\n"
|
||||
"var s2 = new Socket();\n"
|
||||
"print('connecting');\n"
|
||||
"print('before connect', s2.isConnected);\n"
|
||||
"s2.onError(function(e) {\n"
|
||||
" print('error');\n"
|
||||
" print(e);\n"
|
||||
"});\n"
|
||||
"print('noDelay', s2.noDelay);\n"
|
||||
"s2.noDelay = true;\n"
|
||||
"s2.connect('www.unprompted.com', 443).then(function() {\n"
|
||||
" print('connected', 'www.unprompted.com', 443);\n"
|
||||
" s2.read(function(data) {\n"
|
||||
" print('read', data ? data.length : null);\n"
|
||||
" });\n"
|
||||
" return s2.startTls();\n"
|
||||
"}).then(function() {\n"
|
||||
" print('ready');\n"
|
||||
" print(s2.peerName);\n"
|
||||
" s2.write('GET / HTTP/1.0\\r\\nConnection: close\\r\\n\\r\\n').then(function() {\n"
|
||||
" s2.shutdown();\n"
|
||||
" });\n"
|
||||
"}).catch(function(e) {\n"
|
||||
" print('caught');\n"
|
||||
" print(e);\n"
|
||||
"});\n"
|
||||
"var s3 = new Socket();\n"
|
||||
"print('connecting s3');\n"
|
||||
"print('before connect', s3.isConnected);\n"
|
||||
"s3.onError(function(e) {\n"
|
||||
" print('error');\n"
|
||||
" print(e);\n"
|
||||
"});\n"
|
||||
"print('noDelay', s3.noDelay);\n"
|
||||
"s3.noDelay = true;\n"
|
||||
"s3.connect('0.0.0.0', 443).then(function() {\n"
|
||||
" print('connected', '0.0.0.0', 443);\n"
|
||||
" s3.read(function(data) {\n"
|
||||
" print('read', data ? data.length : null);\n"
|
||||
" });\n"
|
||||
" return s3.startTls();\n"
|
||||
"}).then(function() {\n"
|
||||
" print('ready');\n"
|
||||
" print(s3.peerName);\n"
|
||||
" s3.write('GET / HTTP/1.0\\r\\nConnection: close\\r\\n\\r\\n').then(function() {\n"
|
||||
" s3.shutdown();\n"
|
||||
" });\n"
|
||||
"}).catch(function(e) {\n"
|
||||
" print('caught');\n"
|
||||
" print(e);\n"
|
||||
"});\n");
|
||||
|
||||
char command[256];
|
||||
unlink("out/test_db0.sqlite");
|
||||
snprintf(command, sizeof(command), "%s run --db-path=out/test_db0.sqlite -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
unlink("out/test.js");
|
||||
}
|
||||
|
||||
static void _test_file(const tf_test_options_t* options)
|
||||
{
|
||||
_write_file("out/test.js",
|
||||
@@ -1065,7 +978,6 @@ void tf_tests(const tf_test_options_t* options)
|
||||
_tf_test_run(options, "icu", _test_icu, false);
|
||||
_tf_test_run(options, "uint8array", _test_uint8array, false);
|
||||
_tf_test_run(options, "float", _test_float, false);
|
||||
_tf_test_run(options, "socket", _test_socket, false);
|
||||
_tf_test_run(options, "file", _test_file, false);
|
||||
_tf_test_run(options, "b64", _test_b64, false);
|
||||
_tf_test_run(options, "rooms", tf_ssb_test_rooms, false);
|
||||
|
Reference in New Issue
Block a user