diff options
-rw-r--r-- | cli/flags.rs | 12 | ||||
-rw-r--r-- | cli/main.rs | 5 | ||||
-rw-r--r-- | tests/v8_flags.js | 1 | ||||
-rw-r--r-- | tests/v8_flags.js.out | 1 | ||||
-rw-r--r-- | tests/v8_flags.test | 2 | ||||
-rw-r--r-- | tests/v8_help.out | 3 | ||||
-rw-r--r-- | tests/v8_help.test | 2 |
7 files changed, 15 insertions, 11 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index b5a3afdab..d66c9528c 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -2,7 +2,6 @@ use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; // Creates vector of strings, Vec<String> -#[cfg(test)] macro_rules! svec { ($($x:expr),*) => (vec![$($x.to_string()),*]); } @@ -23,7 +22,6 @@ pub struct DenoFlags { pub allow_run: bool, pub allow_high_precision: bool, pub no_prompts: bool, - pub v8_help: bool, pub v8_flags: Option<Vec<String>>, } @@ -245,15 +243,17 @@ pub fn parse_flags(matches: ArgMatches) -> DenoFlags { flags.no_prompts = true; } if matches.is_present("v8-options") { - flags.v8_help = true; + let v8_flags = svec!["deno", "--help"]; + flags.v8_flags = Some(v8_flags); } if matches.is_present("v8-flags") { - let v8_flags: Vec<String> = matches + let mut v8_flags: Vec<String> = matches .values_of("v8-flags") .unwrap() .map(String::from) .collect(); + v8_flags.insert(0, "deno".to_string()); flags.v8_flags = Some(v8_flags); } @@ -408,7 +408,7 @@ mod tests { assert_eq!( flags, DenoFlags { - v8_help: true, + v8_flags: Some(svec!["deno", "--help"]), ..DenoFlags::default() } ); @@ -420,7 +420,7 @@ mod tests { assert_eq!( flags, DenoFlags { - v8_flags: Some(svec!["--expose-gc", "--gc-stats=1"]), + v8_flags: Some(svec!["deno", "--expose-gc", "--gc-stats=1"]), ..DenoFlags::default() } ); diff --git a/cli/main.rs b/cli/main.rs index 45ab334a9..cff42f5a0 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -258,11 +258,6 @@ fn main() { let args: Vec<String> = env::args().collect(); let (flags, subcommand, argv) = flags::flags_from_vec(args); - if flags.v8_help { - // show v8 help and exit - v8_set_flags(vec!["--help".to_string()]); - } - if let Some(ref v8_flags) = flags.v8_flags { v8_set_flags(v8_flags.clone()); } diff --git a/tests/v8_flags.js b/tests/v8_flags.js new file mode 100644 index 000000000..f7999c4af --- /dev/null +++ b/tests/v8_flags.js @@ -0,0 +1 @@ +console.log(typeof gc); diff --git a/tests/v8_flags.js.out b/tests/v8_flags.js.out new file mode 100644 index 000000000..e2dbde096 --- /dev/null +++ b/tests/v8_flags.js.out @@ -0,0 +1 @@ +function diff --git a/tests/v8_flags.test b/tests/v8_flags.test new file mode 100644 index 000000000..66d129bd1 --- /dev/null +++ b/tests/v8_flags.test @@ -0,0 +1,2 @@ +args: --v8-flags=--expose-gc tests/v8_flags.js +output: tests/v8_flags.js.out diff --git a/tests/v8_help.out b/tests/v8_help.out new file mode 100644 index 000000000..3d7aac28d --- /dev/null +++ b/tests/v8_help.out @@ -0,0 +1,3 @@ +[WILDCARD] +Synopsis: +[WILDCARD]d8[WILDCARD]
\ No newline at end of file diff --git a/tests/v8_help.test b/tests/v8_help.test new file mode 100644 index 000000000..2fe105654 --- /dev/null +++ b/tests/v8_help.test @@ -0,0 +1,2 @@ +args: --v8-options +output: tests/v8_help.out |