0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Don't use snapshot for src/isolate.rs tests.

This commit is contained in:
Ryan Dahl 2018-11-26 14:20:16 -05:00
parent a25497fb66
commit 570269b73d
2 changed files with 10 additions and 22 deletions

View file

@ -36,6 +36,11 @@ Deno* deno_new(deno_buf snapshot, deno_buf shared, deno_recv_cb cb) {
v8::MaybeLocal<v8::Value>(),
v8::DeserializeInternalFieldsCallback(
deno::DeserializeInternalFields, nullptr));
if (!snapshot.data_ptr) {
// If no snapshot is provided, we initialize the context with empty
// main source code and source maps.
deno::InitializeContext(isolate, context, "", "", "");
}
d->context_.Reset(isolate, context);
}

View file

@ -393,19 +393,12 @@ fn recv_deadline<T>(
mod tests {
use super::*;
use futures;
use snapshot;
#[test]
fn test_dispatch_sync() {
let argv = vec![String::from("./deno"), String::from("hello.js")];
let (flags, rest_argv, _) = flags::set_flags(argv).unwrap();
// TODO Don't use deno_snapshot for these tests.
let mut isolate = Isolate::new(
unsafe { snapshot::deno_snapshot.clone() },
flags,
rest_argv,
dispatch_sync,
);
let mut isolate = Isolate::new(empty(), flags, rest_argv, dispatch_sync);
tokio_util::init(|| {
isolate
.execute(
@ -445,13 +438,8 @@ mod tests {
fn test_metrics_sync() {
let argv = vec![String::from("./deno"), String::from("hello.js")];
let (flags, rest_argv, _) = flags::set_flags(argv).unwrap();
// TODO Don't use deno_snapshot for these tests.
let mut isolate = Isolate::new(
unsafe { snapshot::deno_snapshot.clone() },
flags,
rest_argv,
metrics_dispatch_sync,
);
let mut isolate =
Isolate::new(empty(), flags, rest_argv, metrics_dispatch_sync);
tokio_util::init(|| {
// Verify that metrics have been properly initialized.
{
@ -486,13 +474,8 @@ mod tests {
fn test_metrics_async() {
let argv = vec![String::from("./deno"), String::from("hello.js")];
let (flags, rest_argv, _) = flags::set_flags(argv).unwrap();
// TODO Don't use deno_snapshot for these tests.
let mut isolate = Isolate::new(
unsafe { snapshot::deno_snapshot.clone() },
flags,
rest_argv,
metrics_dispatch_async,
);
let mut isolate =
Isolate::new(empty(), flags, rest_argv, metrics_dispatch_async);
tokio_util::init(|| {
// Verify that metrics have been properly initialized.
{