0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -05:00
denoland-rusty-v8/tests/test_api_flags.rs
Bert Belder 53e048ffc7
fix: crash on x86_64 systems that support memory protection keys (#1318)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-12 23:26:42 +00:00

20 lines
846 B
Rust

// Tests from the same file run in a single process. That's why this test
// is in its own file, because changing flags affects the whole process.
#[test]
fn set_flags_from_string() {
v8::V8::set_flags_from_string("--use_strict");
v8::V8::initialize_platform(
v8::new_unprotected_default_platform(0, false).make_shared(),
);
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 = "(function() { return this })()";
let source = v8::String::new(scope, source).unwrap();
let script = v8::Script::compile(scope, source, None).unwrap();
let result = script.run(scope).unwrap();
assert!(result.is_undefined()); // Because of --use_strict.
}