Skip to content

Commit

Permalink
Add test for --expose-deno-builtins (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy authored Oct 7, 2023
1 parent 09a6fde commit cdfb89e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion tests/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ mod setup {
))
.is_ok());
v8::V8::set_flags_from_string(
"--no_freeze_flags_after_init --expose_gc --harmony-import-assertions --harmony-shadow-realm --allow_natives_syntax --turbo_fast_api_calls",
"--no_freeze_flags_after_init --expose_deno_builtins --expose_gc --harmony-import-assertions --harmony-shadow-realm --allow_natives_syntax --turbo_fast_api_calls",
);
v8::V8::initialize_platform(
v8::new_unprotected_default_platform(0, false).make_shared(),
Expand Down Expand Up @@ -10901,3 +10901,20 @@ fn allow_scope_in_read_host_object() {
let value = deserializer.read_value(context).unwrap();
assert!(value.is_object());
}

#[test]
fn has_deno_builtins() {
let _setup_guard = setup::parallel_test();

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);

for builtin_name in &["fromUtf8", "toUtf8", "isOneByte"] {
let name = v8::String::new(scope, builtin_name).unwrap();
let value = context.global(scope).get(scope, name.into()).unwrap();
assert!(value.is_function());
}
}
2 changes: 1 addition & 1 deletion v8
Submodule v8 updated 1 files
+11 −10 src/init/bootstrapper.cc

0 comments on commit cdfb89e

Please sign in to comment.