2021-04-12 15:40:52 -04:00
|
|
|
#[test]
|
|
|
|
fn single_threaded_default_platform() {
|
|
|
|
v8::V8::set_flags_from_string("--single_threaded");
|
|
|
|
v8::V8::initialize_platform(
|
2021-07-01 10:05:07 -04:00
|
|
|
v8::new_single_threaded_default_platform(false).make_shared(),
|
2021-04-12 15:40:52 -04:00
|
|
|
);
|
|
|
|
v8::V8::initialize();
|
|
|
|
|
|
|
|
{
|
|
|
|
let isolate = &mut v8::Isolate::new(Default::default());
|
|
|
|
let scope = &mut v8::HandleScope::new(isolate);
|
|
|
|
let context = v8::Context::new(scope);
|
|
|
|
let scope = &mut v8::ContextScope::new(scope, context);
|
|
|
|
let source = v8::String::new(scope, "Math.random()").unwrap();
|
|
|
|
let script = v8::Script::compile(scope, source, None).unwrap();
|
|
|
|
let result = script.run(scope).unwrap();
|
|
|
|
let _ = result.to_string(scope).unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe { v8::V8::dispose() };
|
2022-03-09 08:41:46 -05:00
|
|
|
v8::V8::dispose_platform();
|
2021-04-12 15:40:52 -04:00
|
|
|
}
|