From 97ed0c954d2ae2237bc4aa69ef053f41f99762eb Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 26 Jan 2020 15:49:34 +0100 Subject: feat: make eval support --v8-flags=... (#3797) Closes #3796 --- cli/flags.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'cli/flags.rs') diff --git a/cli/flags.rs b/cli/flags.rs index 42a876947..10709b780 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -353,6 +353,7 @@ fn repl_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { } fn eval_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { + v8_flags_arg_parse(flags, matches); flags.subcommand = DenoSubcommand::Eval; flags.allow_net = true; flags.allow_env = true; @@ -797,6 +798,7 @@ This command has implicit access to all permissions (--allow-all) deno eval \"console.log('hello world')\"", ) .arg(Arg::with_name("code").takes_value(true).required(true)) + .arg(v8_flags_arg()) } fn info_subcommand<'a, 'b>() -> App<'a, 'b> { @@ -1549,6 +1551,28 @@ mod tests { ); } + #[test] + fn eval_with_v8_flags() { + let r = + flags_from_vec_safe(svec!["deno", "eval", "--v8-flags=--help", "42"]); + assert_eq!( + r.unwrap(), + DenoFlags { + subcommand: DenoSubcommand::Eval, + argv: svec!["deno", "42"], + v8_flags: Some(svec!["--help"]), + allow_net: true, + allow_env: true, + allow_run: true, + allow_read: true, + allow_write: true, + allow_plugin: true, + allow_hrtime: true, + ..DenoFlags::default() + } + ); + } + #[test] fn repl() { let r = flags_from_vec_safe(svec!["deno"]); -- cgit v1.2.3