From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/cargo/tests/testsuite/config.rs | 62 ++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'src/tools/cargo/tests/testsuite/config.rs') diff --git a/src/tools/cargo/tests/testsuite/config.rs b/src/tools/cargo/tests/testsuite/config.rs index b0f9d167b..5d4163818 100644 --- a/src/tools/cargo/tests/testsuite/config.rs +++ b/src/tools/cargo/tests/testsuite/config.rs @@ -1,7 +1,7 @@ //! Tests for config settings. use cargo::core::{PackageIdSpec, Shell}; -use cargo::util::config::{self, Config, Definition, SslVersionConfig, StringList}; +use cargo::util::config::{self, Config, Definition, JobsConfig, SslVersionConfig, StringList}; use cargo::util::interning::InternedString; use cargo::util::toml::{self as cargo_toml, TomlDebugInfo, VecStringOrBool as VSOB}; use cargo::CargoResult; @@ -1651,3 +1651,63 @@ fn debuginfo_parsing() { .ends_with("could not load config key `profile.dev.debug`")); } } + +#[cargo_test] +fn build_jobs_missing() { + write_config( + "\ +[build] +", + ); + + let config = new_config(); + + assert!(config + .get::>("build.jobs") + .unwrap() + .is_none()); +} + +#[cargo_test] +fn build_jobs_default() { + write_config( + "\ +[build] +jobs = \"default\" +", + ); + + let config = new_config(); + + let a = config + .get::>("build.jobs") + .unwrap() + .unwrap(); + + match a { + JobsConfig::String(v) => assert_eq!(&v, "default"), + JobsConfig::Integer(_) => panic!("Did not except an integer."), + } +} + +#[cargo_test] +fn build_jobs_integer() { + write_config( + "\ +[build] +jobs = 2 +", + ); + + let config = new_config(); + + let a = config + .get::>("build.jobs") + .unwrap() + .unwrap(); + + match a { + JobsConfig::String(_) => panic!("Did not except an integer."), + JobsConfig::Integer(v) => assert_eq!(v, 2), + } +} -- cgit v1.2.3