mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
Format.
This commit is contained in:
parent
f949ded933
commit
787832c68e
6 changed files with 37 additions and 20 deletions
2
BUILD.gn
2
BUILD.gn
|
@ -199,7 +199,7 @@ run_node("gen_declarations") {
|
|||
"js/tsconfig.generated.json",
|
||||
"js/types.ts",
|
||||
"js/util.ts",
|
||||
"js/v8_source_maps.ts"
|
||||
"js/v8_source_maps.ts",
|
||||
]
|
||||
outputs = [
|
||||
"$out_dir/types/globals.d.ts",
|
||||
|
|
|
@ -427,10 +427,7 @@ export class DenoCompiler implements ts.LanguageServiceHost {
|
|||
*/
|
||||
makeDefine(moduleMetaData: ModuleMetaData): AmdDefine {
|
||||
// TODO should this really be part of the public API of the compiler?
|
||||
return (
|
||||
deps: ModuleSpecifier[],
|
||||
factory: AmdFactory
|
||||
): void => {
|
||||
return (deps: ModuleSpecifier[], factory: AmdFactory): void => {
|
||||
this._log("compiler.localDefine", moduleMetaData.fileName);
|
||||
moduleMetaData.factory = factory;
|
||||
// when there are circular dependencies, we need to skip recursing the
|
||||
|
|
|
@ -36,7 +36,7 @@ function permFromString(s: string): DenoPermissions {
|
|||
return {
|
||||
write: Boolean(Number(found[1])),
|
||||
net: Boolean(Number(found[2])),
|
||||
env: Boolean(Number(found[3])),
|
||||
env: Boolean(Number(found[3]))
|
||||
};
|
||||
}
|
||||
|
||||
|
|
22
src/flags.rs
22
src/flags.rs
|
@ -61,7 +61,9 @@ pub fn set_flags(args: Vec<String>) -> (DenoFlags, Vec<String>) {
|
|||
fn test_set_flags_1() {
|
||||
let (flags, rest) = set_flags(svec!["deno", "--version"]);
|
||||
assert_eq!(rest, svec!["deno"]);
|
||||
assert_eq!(flags, DenoFlags {
|
||||
assert_eq!(
|
||||
flags,
|
||||
DenoFlags {
|
||||
version: true,
|
||||
..DenoFlags::default()
|
||||
}
|
||||
|
@ -72,7 +74,9 @@ fn test_set_flags_1() {
|
|||
fn test_set_flags_2() {
|
||||
let (flags, rest) = set_flags(svec!["deno", "-r", "-D", "script.ts"]);
|
||||
assert_eq!(rest, svec!["deno", "script.ts"]);
|
||||
assert_eq!(flags, DenoFlags {
|
||||
assert_eq!(
|
||||
flags,
|
||||
DenoFlags {
|
||||
log_debug: true,
|
||||
reload: true,
|
||||
..DenoFlags::default()
|
||||
|
@ -85,7 +89,9 @@ fn test_set_flags_3() {
|
|||
let (flags, rest) =
|
||||
set_flags(svec!["deno", "-r", "script.ts", "--allow-write"]);
|
||||
assert_eq!(rest, svec!["deno", "script.ts"]);
|
||||
assert_eq!(flags, DenoFlags {
|
||||
assert_eq!(
|
||||
flags,
|
||||
DenoFlags {
|
||||
reload: true,
|
||||
allow_write: true,
|
||||
..DenoFlags::default()
|
||||
|
@ -125,13 +131,19 @@ fn parse_core_args(args: Vec<String>) -> (Vec<String>, Vec<String>) {
|
|||
fn test_parse_core_args_1() {
|
||||
let js_args =
|
||||
parse_core_args(vec!["deno".to_string(), "--v8-options".to_string()]);
|
||||
assert_eq!(js_args, (vec!["deno".to_string(), "--help".to_string()], vec![]));
|
||||
assert_eq!(
|
||||
js_args,
|
||||
(vec!["deno".to_string(), "--help".to_string()], vec![])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_core_args_2() {
|
||||
let js_args = parse_core_args(vec!["deno".to_string(), "--help".to_string()]);
|
||||
assert_eq!(js_args, (vec!["deno".to_string()], vec!["--help".to_string()]));
|
||||
assert_eq!(
|
||||
js_args,
|
||||
(vec!["deno".to_string()], vec!["--help".to_string()])
|
||||
);
|
||||
}
|
||||
|
||||
// Pass the command line arguments to v8.
|
||||
|
|
|
@ -284,16 +284,21 @@ fn handle_env(
|
|||
return Err(err.into());
|
||||
}
|
||||
|
||||
let vars: Vec<_> = std::env::vars().map(|(key, value)| {
|
||||
let key = builder.create_string(&key);
|
||||
let value = builder.create_string(&value);
|
||||
let vars: Vec<_> = std::env::vars()
|
||||
.map(|(key, value)| {
|
||||
let key = builder.create_string(&key);
|
||||
let value = builder.create_string(&value);
|
||||
|
||||
msg::EnvPair::create(builder, &msg::EnvPairArgs {
|
||||
key: Some(key),
|
||||
value: Some(value),
|
||||
..Default::default()
|
||||
msg::EnvPair::create(
|
||||
builder,
|
||||
&msg::EnvPairArgs {
|
||||
key: Some(key),
|
||||
value: Some(value),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
})
|
||||
}).collect();
|
||||
.collect();
|
||||
|
||||
let tables = builder.create_vector_of_reverse_offsets(&vars);
|
||||
|
||||
|
|
|
@ -15,7 +15,10 @@ def unit_tests(deno_exe):
|
|||
run([deno_exe, "js/unit_tests.ts", "permW0N1E0", "--allow-net"])
|
||||
run([deno_exe, "js/unit_tests.ts", "permW0N0E1", "--allow-env"])
|
||||
run([
|
||||
deno_exe, "js/unit_tests.ts", "permW1N1E1", "--allow-write",
|
||||
deno_exe,
|
||||
"js/unit_tests.ts",
|
||||
"permW1N1E1",
|
||||
"--allow-write",
|
||||
"--allow-net",
|
||||
"--allow-env",
|
||||
])
|
||||
|
|
Loading…
Reference in a new issue