From 808f35f19f4d8727766508b5bc0219e427185827 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 4 Apr 2014 17:52:27 -0400 Subject: [PATCH] Run tests in green tasks. --- js.rc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js.rc b/js.rc index 1c1acf9ff..62cd641a3 100644 --- a/js.rc +++ b/js.rc @@ -14,6 +14,9 @@ #[feature(phase)]; #[phase(syntax, link)] extern crate log; +#[cfg(test)] +extern crate rustuv; + extern crate green; extern crate serialize; @@ -141,3 +144,14 @@ pub unsafe fn JS_THIS_OBJECT(cx: *JSContext, vp: *mut JSVal) -> *JSObject { pub unsafe fn JS_CALLEE(_cx: *JSContext, vp: *JSVal) -> JSVal { *vp } + +// Run tests with libgreen instead of libnative. +// +// FIXME: This egregiously hacks around starting the test runner in a different +// threading mode than the default by reaching into the auto-generated +// '__test' module. +#[cfg(test)] +#[start] +fn start(argc: int, argv: **u8) -> int { + green::start(argc, argv, __test::main) +}