Skip to content

Commit

Permalink
rename parse_core_args to v8_set_flags_preprocess (denoland#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
ztplz authored and ry committed Oct 1, 2018
1 parent bcdbfc0 commit 1fcc11a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ fn test_set_flags_4() {
}

// Returns args passed to V8, followed by args passed to JS
// TODO Rename to v8_set_flags_preprocess
fn parse_core_args(args: Vec<String>) -> (Vec<String>, Vec<String>) {
fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) {
let mut rest = vec![];

// Filter out args that shouldn't be passed to V8
Expand All @@ -193,18 +192,18 @@ fn parse_core_args(args: Vec<String>) -> (Vec<String>, Vec<String>) {
}

#[test]
fn test_parse_core_args_1() {
fn test_v8_set_flags_preprocess_1() {
let js_args =
parse_core_args(vec!["deno".to_string(), "--v8-options".to_string()]);
v8_set_flags_preprocess(vec!["deno".to_string(), "--v8-options".to_string()]);
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()]);
fn test_v8_set_flags_preprocess_2() {
let js_args = v8_set_flags_preprocess(vec!["deno".to_string(), "--help".to_string()]);
assert_eq!(
js_args,
(vec!["deno".to_string()], vec!["--help".to_string()])
Expand All @@ -217,7 +216,7 @@ pub fn v8_set_flags(args: Vec<String>) -> Vec<String> {
// deno_set_v8_flags(int* argc, char** argv) mutates argc and argv to remove
// flags that v8 understands.
// First parse core args, then converto to a vector of C strings.
let (argv, rest) = parse_core_args(args);
let (argv, rest) = v8_set_flags_preprocess(args);
let mut argv = argv
.iter()
.map(|arg| CString::new(arg.as_str()).unwrap().into_bytes_with_nul())
Expand Down

0 comments on commit 1fcc11a

Please sign in to comment.