diff options
-rw-r--r-- | core/bindings.rs | 1 | ||||
-rw-r--r-- | core/runtime.rs | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index 7b3abc602..cf4fd07f6 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -180,6 +180,7 @@ pub fn set_func( let key = v8::String::new(scope, name).unwrap(); let tmpl = v8::FunctionTemplate::new(scope, callback); let val = tmpl.get_function(scope).unwrap(); + val.set_name(key); obj.set(scope, key.into(), val.into()); } diff --git a/core/runtime.rs b/core/runtime.rs index e4fe8cd6c..1150746f3 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2303,4 +2303,18 @@ assertEquals(1, notify_return_value); let all_true = v8::Local::<v8::Value>::new(&mut scope, &all_true); assert!(all_true.is_true()); } + + #[test] + fn test_binding_names() { + let mut runtime = JsRuntime::new(RuntimeOptions::default()); + let all_true: v8::Global<v8::Value> = runtime + .execute_script( + "binding_names.js", + "Deno.core.encode.toString() === 'function encode() { [native code] }'", + ) + .unwrap(); + let mut scope = runtime.handle_scope(); + let all_true = v8::Local::<v8::Value>::new(&mut scope, &all_true); + assert!(all_true.is_true()); + } } |