diff options
-rw-r--r-- | cli/tests/integration_tests.rs | 12 | ||||
-rw-r--r-- | core/bindings.rs | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 5f4b37744..ff94d2f50 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -746,6 +746,18 @@ fn repl_test_console_log() { } #[test] +fn repl_cwd() { + let (_out, err) = util::run_and_collect_output( + true, + "repl", + Some(vec!["Deno.cwd()"]), + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), + false, + ); + assert!(err.is_empty()); +} + +#[test] fn repl_test_eof() { let (out, err) = util::run_and_collect_output( true, diff --git a/core/bindings.rs b/core/bindings.rs index b6390073a..877e81579 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -536,9 +536,11 @@ fn eval_context( mut rv: v8::ReturnValue, ) { let state_rc = CoreIsolate::state(scope.isolate()); - let state = state_rc.borrow(); - assert!(!state.global_context.is_empty()); - let context = state.global_context.get(scope).unwrap(); + let context = { + let state = state_rc.borrow(); + assert!(!state.global_context.is_empty()); + state.global_context.get(scope).unwrap() + }; let source = match v8::Local::<v8::String>::try_from(args.get(0)) { Ok(s) => s, |