mirror of
https://github.com/denoland/deno.git
synced 2024-12-31 11:34:15 -05:00
Format
This commit is contained in:
parent
1322f3de9f
commit
590feb1c71
5 changed files with 17 additions and 20 deletions
|
@ -209,8 +209,7 @@ fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Replace args being sent to V8
|
// Replace args being sent to V8
|
||||||
for idx in 0..args.len() {
|
for idx in 0..args.len() {
|
||||||
|
@ -279,7 +278,6 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
|
||||||
let cstr = CStr::from_ptr(*ptr as *const i8);
|
let cstr = CStr::from_ptr(*ptr as *const i8);
|
||||||
let slice = cstr.to_str().unwrap();
|
let slice = cstr.to_str().unwrap();
|
||||||
slice.to_string()
|
slice.to_string()
|
||||||
})
|
}).chain(rest.into_iter())
|
||||||
.chain(rest.into_iter())
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,8 +372,7 @@ mod tests {
|
||||||
throw Error("assert error");
|
throw Error("assert error");
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
).expect("execute error");
|
||||||
.expect("execute error");
|
|
||||||
isolate.event_loop();
|
isolate.event_loop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -418,8 +417,7 @@ mod tests {
|
||||||
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
const data = new Uint8Array([42, 43, 44, 45, 46]);
|
||||||
libdeno.send(control, data);
|
libdeno.send(control, data);
|
||||||
"#,
|
"#,
|
||||||
)
|
).expect("execute error");
|
||||||
.expect("execute error");
|
|
||||||
isolate.event_loop();
|
isolate.event_loop();
|
||||||
let metrics = isolate.state.metrics.lock().unwrap();
|
let metrics = isolate.state.metrics.lock().unwrap();
|
||||||
assert_eq!(metrics.ops_dispatched, 1);
|
assert_eq!(metrics.ops_dispatched, 1);
|
||||||
|
@ -455,8 +453,7 @@ mod tests {
|
||||||
let r = libdeno.send(control, data);
|
let r = libdeno.send(control, data);
|
||||||
if (r != null) throw Error("expected null");
|
if (r != null) throw Error("expected null");
|
||||||
"#,
|
"#,
|
||||||
)
|
).expect("execute error");
|
||||||
.expect("execute error");
|
|
||||||
|
|
||||||
// Make sure relevant metrics are updated before task is executed.
|
// Make sure relevant metrics are updated before task is executed.
|
||||||
{
|
{
|
||||||
|
|
12
src/ops.rs
12
src/ops.rs
|
@ -113,7 +113,8 @@ pub fn dispatch(
|
||||||
op_creator(isolate.state.clone(), &base, data)
|
op_creator(isolate.state.clone(), &base, data)
|
||||||
};
|
};
|
||||||
|
|
||||||
let boxed_op = Box::new(op.or_else(move |err: DenoError| -> DenoResult<Buf> {
|
let boxed_op = Box::new(
|
||||||
|
op.or_else(move |err: DenoError| -> DenoResult<Buf> {
|
||||||
debug!("op err {}", err);
|
debug!("op err {}", err);
|
||||||
// No matter whether we got an Err or Ok, we want a serialized message to
|
// No matter whether we got an Err or Ok, we want a serialized message to
|
||||||
// send back. So transform the DenoError into a deno_buf.
|
// send back. So transform the DenoError into a deno_buf.
|
||||||
|
@ -145,7 +146,8 @@ pub fn dispatch(
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"msg_from_js {} sync {}",
|
"msg_from_js {} sync {}",
|
||||||
|
@ -367,8 +369,7 @@ fn op_env(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
let tables = builder.create_vector(&vars);
|
let tables = builder.create_vector(&vars);
|
||||||
let inner = msg::EnvironRes::create(
|
let inner = msg::EnvironRes::create(
|
||||||
builder,
|
builder,
|
||||||
|
@ -948,8 +949,7 @@ fn op_read_dir(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
|
|
||||||
let entries = builder.create_vector(&entries);
|
let entries = builder.create_vector(&entries);
|
||||||
let inner = msg::ReadDirRes::create(
|
let inner = msg::ReadDirRes::create(
|
||||||
|
|
|
@ -6,6 +6,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
from util import rmtree, run
|
from util import rmtree, run
|
||||||
|
|
||||||
|
|
||||||
def deno_dir_test(deno_exe, deno_dir):
|
def deno_dir_test(deno_exe, deno_dir):
|
||||||
assert os.path.isfile(deno_exe)
|
assert os.path.isfile(deno_exe)
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ def deno_dir_test(deno_exe, deno_dir):
|
||||||
rmtree(deno_dir)
|
rmtree(deno_dir)
|
||||||
|
|
||||||
if old_deno_dir is not None:
|
if old_deno_dir is not None:
|
||||||
os.environ["DENO_DIR"] = old_deno_dir
|
os.environ["DENO_DIR"] = old_deno_dir
|
||||||
|
|
||||||
|
|
||||||
def run_deno(deno_exe, deno_dir=None):
|
def run_deno(deno_exe, deno_dir=None):
|
||||||
|
@ -37,6 +38,7 @@ def run_deno(deno_exe, deno_dir=None):
|
||||||
deno_dir_env = {"DENO_DIR": deno_dir} if deno_dir is not None else None
|
deno_dir_env = {"DENO_DIR": deno_dir} if deno_dir is not None else None
|
||||||
run(cmd, quiet=True, env=deno_dir_env)
|
run(cmd, quiet=True, env=deno_dir_env)
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
print "Usage ./tools/deno_dir_test.py out/debug/deno out/debug/.deno_dir"
|
print "Usage ./tools/deno_dir_test.py out/debug/deno out/debug/.deno_dir"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def run_unit_test2(cmd):
|
def run_unit_test2(cmd):
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
cmd,
|
cmd,
|
||||||
|
@ -26,6 +27,7 @@ def run_unit_test2(cmd):
|
||||||
if errcode != 0:
|
if errcode != 0:
|
||||||
sys.exit(errcode)
|
sys.exit(errcode)
|
||||||
|
|
||||||
|
|
||||||
def run_unit_test(deno_exe, permStr, flags=[]):
|
def run_unit_test(deno_exe, permStr, flags=[]):
|
||||||
cmd = [deno_exe, "--reload", "js/unit_tests.ts", permStr] + flags
|
cmd = [deno_exe, "--reload", "js/unit_tests.ts", permStr] + flags
|
||||||
run_unit_test2(cmd)
|
run_unit_test2(cmd)
|
||||||
|
@ -48,9 +50,7 @@ def unit_tests(deno_exe):
|
||||||
# These are not strictly unit tests for Deno, but for ts_library_builder.
|
# These are not strictly unit tests for Deno, but for ts_library_builder.
|
||||||
# They run under Node, but use the same //js/testing/ library.
|
# They run under Node, but use the same //js/testing/ library.
|
||||||
run_unit_test2([
|
run_unit_test2([
|
||||||
"node",
|
"node", "./node_modules/.bin/ts-node", "--project",
|
||||||
"./node_modules/.bin/ts-node",
|
|
||||||
"--project",
|
|
||||||
"tools/ts_library_builder/tsconfig.json",
|
"tools/ts_library_builder/tsconfig.json",
|
||||||
"tools/ts_library_builder/test.ts"
|
"tools/ts_library_builder/test.ts"
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in a new issue