Skip to content

Commit

Permalink
add tests for -c option
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 31, 2020
1 parent c3b625d commit d863a36
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/argv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,22 @@ fn repo_specified_but_argument_is_not_empty() {
e => assert!(false, "Unexpected error: {}", e),
}
}

#[test]
fn current_branch_flag() {
match Parsed::parse_iter(&["git-brws", "-c"]).unwrap() {
Parsed::OpenPage(c) => {
assert!(c.branch.is_some());
}
p => panic!("{:?}", p),
}

// When --current-branch and --branch are both specified, --branch is prioritized.
// Note: -r is necessary to avoid "no such branch 'dev'" error.
match Parsed::parse_iter(&["git-brws", "-r", "foo/bar", "-c", "-b", "dev"]).unwrap() {
Parsed::OpenPage(c) => {
assert_eq!(c.branch, Some("dev".to_string()));
}
p => panic!("{:?}", p),
}
}

0 comments on commit d863a36

Please sign in to comment.