Skip to content

Commit

Permalink
test(config): Show current git-fetch-with-cli behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jun 1, 2024
1 parent 92f61d0 commit 0ac2bd8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/testsuite/config_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ use std::{collections::HashMap, fs};
#[cargo_test]
fn basic() {
// Simple example.
let gctx = GlobalContextBuilder::new().config_arg("foo='bar'").build();
let gctx = GlobalContextBuilder::new()
.config_arg("foo='bar'")
.config_arg("net.git-fetch-with-cli=true")
.build();
assert_eq!(gctx.get::<String>("foo").unwrap(), "bar");
assert_eq!(gctx.net_config().unwrap().git_fetch_with_cli, None);
}

#[cargo_test]
Expand All @@ -39,13 +43,16 @@ fn cli_priority() {
.env("CARGO_BUILD_JOBS", "2")
.env("CARGO_BUILD_RUSTC", "env")
.env("CARGO_TERM_VERBOSE", "false")
.env("CARGO_NET_GIT_FETCH_WITH_CLI", "false")
.config_arg("build.jobs=1")
.config_arg("build.rustc='cli'")
.config_arg("term.verbose=true")
.config_arg("net.git-fetch-with-cli=true")
.build();
assert_eq!(gctx.get::<i32>("build.jobs").unwrap(), 1);
assert_eq!(gctx.get::<String>("build.rustc").unwrap(), "cli");
assert_eq!(gctx.get::<bool>("term.verbose").unwrap(), true);
assert_eq!(gctx.net_config().unwrap().git_fetch_with_cli, Some(false));

// Setting both term.verbose and term.quiet is invalid and is tested
// in the run test suite.
Expand Down

0 comments on commit 0ac2bd8

Please sign in to comment.