forked from cory/tildefriends
Moving a little bit more to this test.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3661 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "ssb.qjs.h"
|
||||
|
||||
#include "database.h"
|
||||
#include "ssb.db.h"
|
||||
#include "ssb.h"
|
||||
#include "task.h"
|
||||
@ -17,6 +18,7 @@ static JSClassID _tf_ssb_classId;
|
||||
static JSValue _tf_ssb_whoami(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||
{
|
||||
tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId);
|
||||
printf("WHOAMI on %p\n", ssb);
|
||||
if (ssb) {
|
||||
char id[512];
|
||||
if (tf_ssb_whoami(ssb, id, sizeof(id))) {
|
||||
@ -564,6 +566,18 @@ void tf_ssb_run_file(JSContext* context, const char* file_name)
|
||||
JS_FreeCString(context, value);
|
||||
JS_FreeValue(context, error);
|
||||
}
|
||||
|
||||
JSRuntime* runtime = JS_GetRuntime(context);
|
||||
while (JS_IsJobPending(runtime)) {
|
||||
JSContext* context2 = NULL;
|
||||
int r = JS_ExecutePendingJob(runtime, &context2);
|
||||
JSValue result = JS_GetException(context2);
|
||||
_check_call(context, result);
|
||||
if (r == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
JS_FreeValue(context, result);
|
||||
free(source);
|
||||
}
|
||||
@ -650,5 +664,6 @@ void tf_ssb_init(JSContext* context, tf_ssb_t* ssb)
|
||||
|
||||
JS_FreeValue(context, global);
|
||||
|
||||
tf_database_init(context, tf_ssb_get_db(ssb));
|
||||
tf_ssb_run_file(context, "core/ssb.js");
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ void tf_ssb_test_ssb(const tf_test_options_t* options)
|
||||
bool b = tf_ssb_whoami(ssb0, id0, sizeof(id0));
|
||||
(void)b;
|
||||
assert(b);
|
||||
b = tf_ssb_whoami(ssb0, id0, sizeof(id0));
|
||||
b = tf_ssb_whoami(ssb1, id1, sizeof(id1));
|
||||
assert(b);
|
||||
printf("ID %s and %s\n", id0, id1);
|
||||
|
||||
|
@ -497,7 +497,7 @@ static void _tf_test_run(const tf_test_options_t* options, const char* name, voi
|
||||
}
|
||||
|
||||
if (!options->tests || specified) {
|
||||
printf("Running test %s.", name);
|
||||
printf("Running test %s.\n", name);
|
||||
test(options);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user