summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs498
1 files changed, 217 insertions, 281 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 5a77c8bb2..9bd3a62d4 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -213,6 +213,14 @@ pub struct RunFlags {
}
impl RunFlags {
+ #[cfg(test)]
+ pub fn new_default(script: String) -> Self {
+ Self {
+ script,
+ watch: None,
+ }
+ }
+
pub fn is_stdin(&self) -> bool {
self.script == "-"
}
@@ -4151,10 +4159,9 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string()
+ )),
unstable: true,
log_level: Some(Level::Error),
..Flags::default()
@@ -4206,10 +4213,9 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string()
+ )),
reload: true,
..Flags::default()
}
@@ -4350,7 +4356,7 @@ mod tests {
hmr: false,
paths: vec![],
no_clear_screen: true,
- })
+ }),
}),
..Flags::default()
}
@@ -4365,10 +4371,9 @@ mod tests {
r.unwrap(),
Flags {
reload: true,
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string()
+ )),
allow_write: Some(vec![]),
..Flags::default()
}
@@ -4381,10 +4386,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "_".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default("_".to_string())),
v8_flags: svec!["--help"],
..Flags::default()
}
@@ -4399,10 +4401,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string()
+ )),
v8_flags: svec!["--expose-gc", "--gc-stats=1"],
..Flags::default()
}
@@ -4452,10 +4453,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "gist.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string()
+ )),
argv: svec!["--title", "X"],
allow_net: Some(vec![]),
..Flags::default()
@@ -4469,10 +4469,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "gist.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string()
+ )),
allow_all: true,
allow_net: Some(vec![]),
allow_env: Some(vec![]),
@@ -4493,10 +4492,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "gist.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string()
+ )),
allow_read: Some(vec![]),
..Flags::default()
}
@@ -4509,10 +4507,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "gist.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string()
+ )),
deny_read: Some(vec![]),
..Flags::default()
}
@@ -4525,10 +4522,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "gist.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string(),
+ )),
allow_hrtime: true,
..Flags::default()
}
@@ -4541,10 +4537,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "gist.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "gist.ts".to_string(),
+ )),
deny_hrtime: true,
..Flags::default()
}
@@ -4568,10 +4563,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
argv: svec!["--", "-D", "--allow-net"],
allow_write: Some(vec![]),
..Flags::default()
@@ -5283,10 +5277,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
config_flag: ConfigFlag::Path("tsconfig.json".to_owned()),
..Flags::default()
}
@@ -5574,10 +5567,9 @@ mod tests {
r.unwrap(),
Flags {
allow_read: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
..Flags::default()
}
);
@@ -5599,10 +5591,9 @@ mod tests {
r.unwrap(),
Flags {
deny_read: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
..Flags::default()
}
);
@@ -5624,10 +5615,9 @@ mod tests {
r.unwrap(),
Flags {
allow_write: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
..Flags::default()
}
);
@@ -5649,10 +5639,9 @@ mod tests {
r.unwrap(),
Flags {
deny_write: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
..Flags::default()
}
);
@@ -5669,10 +5658,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_net: Some(svec!["127.0.0.1"]),
..Flags::default()
}
@@ -5686,10 +5674,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_net: Some(svec!["127.0.0.1"]),
..Flags::default()
}
@@ -5703,10 +5690,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_env: Some(svec!["HOME"]),
..Flags::default()
}
@@ -5720,10 +5706,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_env: Some(svec!["HOME"]),
..Flags::default()
}
@@ -5741,10 +5726,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_env: Some(svec!["HOME", "PATH"]),
..Flags::default()
}
@@ -5758,10 +5742,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_env: Some(svec!["HOME", "PATH"]),
..Flags::default()
}
@@ -5800,10 +5783,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_sys: Some(vec![]),
..Flags::default()
}
@@ -5816,10 +5798,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_sys: Some(vec![]),
..Flags::default()
}
@@ -5833,10 +5814,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_sys: Some(svec!["hostname"]),
..Flags::default()
}
@@ -5850,10 +5830,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_sys: Some(svec!["hostname"]),
..Flags::default()
}
@@ -5871,10 +5850,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_sys: Some(svec!["hostname", "osRelease"]),
..Flags::default()
}
@@ -5892,10 +5870,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_sys: Some(svec!["hostname", "osRelease"]),
..Flags::default()
}
@@ -6199,10 +6176,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
@@ -6281,10 +6257,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
env_file: Some(".env".to_owned()),
..Flags::default()
}
@@ -6298,10 +6273,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
env_file: Some(".another_env".to_owned()),
..Flags::default()
}
@@ -6329,10 +6303,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
seed: Some(250_u64),
v8_flags: svec!["--random-seed=250"],
..Flags::default()
@@ -6353,10 +6326,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
seed: Some(250_u64),
v8_flags: svec!["--expose-gc", "--random-seed=250"],
..Flags::default()
@@ -6449,10 +6421,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
log_level: Some(Level::Debug),
..Flags::default()
}
@@ -6465,10 +6436,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
log_level: Some(Level::Error),
..Flags::default()
}
@@ -6499,10 +6469,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
argv: svec!["--allow-read", "--allow-net"],
..Flags::default()
}
@@ -6523,10 +6492,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
location: Some(Url::parse("https://foo/").unwrap()),
allow_read: Some(vec![]),
argv: svec!["--allow-net", "-r", "--help", "--foo", "bar"],
@@ -6538,10 +6506,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
argv: svec!["foo", "bar"],
..Flags::default()
}
@@ -6550,10 +6517,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
argv: svec!["-"],
..Flags::default()
}
@@ -6564,10 +6530,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
argv: svec!["-", "foo", "bar"],
..Flags::default()
}
@@ -6580,10 +6545,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
type_check_mode: TypeCheckMode::None,
..Flags::default()
}
@@ -6597,10 +6561,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
type_check_mode: TypeCheckMode::Local,
..Flags::default()
}
@@ -6642,10 +6605,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
unsafely_ignore_certificate_errors: Some(vec![]),
..Flags::default()
}
@@ -6663,10 +6625,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
unsafely_ignore_certificate_errors: Some(svec![
"deno.land",
"localhost",
@@ -6714,10 +6675,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
no_remote: true,
..Flags::default()
}
@@ -6730,10 +6690,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
no_npm: true,
..Flags::default()
}
@@ -6747,10 +6706,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
node_modules_dir: Some(true),
..Flags::default()
}
@@ -6765,10 +6723,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
node_modules_dir: Some(false),
..Flags::default()
}
@@ -6781,10 +6738,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
vendor: Some(true),
..Flags::default()
}
@@ -6794,10 +6750,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
vendor: Some(false),
..Flags::default()
}
@@ -6810,10 +6765,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
cached_only: true,
..Flags::default()
}
@@ -6831,10 +6785,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_net: Some(svec![
"deno.land",
"0.0.0.0:8000",
@@ -6860,10 +6813,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_net: Some(svec![
"deno.land",
"0.0.0.0:8000",
@@ -6889,10 +6841,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
allow_net: Some(svec![
"deno.land",
"deno.land:80",
@@ -6921,10 +6872,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- watch: None,
- script: "script.ts".to_string(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
deny_net: Some(svec![
"deno.land",
"deno.land:80",
@@ -6954,10 +6904,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
lock_write: true,
lock: Some(PathBuf::from("lock.json")),
..Flags::default()
@@ -6968,10 +6917,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
no_lock: true,
..Flags::default()
}
@@ -6987,10 +6935,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
lock_write: true,
lock: Some(PathBuf::from("./deno.lock")),
..Flags::default()
@@ -7008,10 +6955,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
lock_write: true,
lock: Some(PathBuf::from("lock.json")),
..Flags::default()
@@ -7022,10 +6968,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
lock_write: true,
..Flags::default()
}
@@ -7112,10 +7057,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
ca_data: Some(CaData::File("example.crt".to_owned())),
..Flags::default()
}
@@ -7133,10 +7077,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
enable_testing_features: true,
..Flags::default()
}
@@ -7794,10 +7737,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "foo.js".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "foo.js".to_string(),
+ )),
inspect: Some("127.0.0.1:9229".parse().unwrap()),
..Flags::default()
}
@@ -7810,10 +7752,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "foo.js".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "foo.js".to_string(),
+ )),
inspect_wait: Some("127.0.0.1:9229".parse().unwrap()),
..Flags::default()
}
@@ -7828,10 +7769,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "foo.js".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "foo.js".to_string(),
+ )),
inspect_wait: Some("127.0.0.1:3567".parse().unwrap()),
..Flags::default()
}
@@ -8329,10 +8269,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
type_check_mode: TypeCheckMode::Local,
..Flags::default()
}
@@ -8342,10 +8281,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
type_check_mode: TypeCheckMode::All,
..Flags::default()
}
@@ -8355,10 +8293,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
type_check_mode: TypeCheckMode::None,
..Flags::default()
}
@@ -8380,10 +8317,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run(RunFlags {
- script: "script.ts".to_string(),
- watch: Default::default(),
- }),
+ subcommand: DenoSubcommand::Run(RunFlags::new_default(
+ "script.ts".to_string(),
+ )),
config_flag: ConfigFlag::Disabled,
..Flags::default()
}