From cdfb89e8a70585bedda5da9defc27574ae322585 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 7 Oct 2023 21:34:11 +0530 Subject: [PATCH] Add test for `--expose-deno-builtins` (#1344) --- tests/test_api.rs | 19 ++++++++++++++++++- v8 | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/test_api.rs b/tests/test_api.rs index d21a4009ad..c2ca246ba0 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -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(), @@ -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()); + } +} diff --git a/v8 b/v8 index 69fd0491ac..99232750c0 160000 --- a/v8 +++ b/v8 @@ -1 +1 @@ -Subproject commit 69fd0491aca048782ce6267cc366ddb8ab470b01 +Subproject commit 99232750c02ebf21013c72ffaec0f0d7c3bfb964