diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/tools/cargo/tests/testsuite/bad_config.rs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/tests/testsuite/bad_config.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/bad_config.rs | 152 |
1 files changed, 136 insertions, 16 deletions
diff --git a/src/tools/cargo/tests/testsuite/bad_config.rs b/src/tools/cargo/tests/testsuite/bad_config.rs index 4434ea90d..82da880ea 100644 --- a/src/tools/cargo/tests/testsuite/bad_config.rs +++ b/src/tools/cargo/tests/testsuite/bad_config.rs @@ -172,9 +172,6 @@ Caused by: could not parse TOML configuration in `[..]` Caused by: - could not parse input as TOML - -Caused by: TOML parse error at line 1, column 2 | 1 | 4 @@ -199,8 +196,11 @@ fn bad_cargo_lock() { [ERROR] failed to parse lock file at: [..]Cargo.lock Caused by: + TOML parse error at line 1, column 1 + | + 1 | [[package]] + | ^^^^^^^^^^^ missing field `name` - in `package` ", ) .run(); @@ -303,8 +303,11 @@ fn bad_source_in_cargo_lock() { [ERROR] failed to parse lock file at: [..] Caused by: + TOML parse error at line 12, column 26 + | + 12 | source = \"You shall not parse\" + | ^^^^^^^^^^^^^^^^^^^^^ invalid source `You shall not parse` - in `package.source` ", ) .run(); @@ -449,9 +452,6 @@ fn malformed_override() { [ERROR] failed to parse manifest at `[..]` Caused by: - could not parse input as TOML - -Caused by: TOML parse error at line 8, column 27 | 8 | native = { @@ -804,9 +804,6 @@ Caused by: could not parse TOML configuration in `[..]` Caused by: - could not parse input as TOML - -Caused by: TOML parse error at line 1, column 7 | 1 | [bar] baz = 2 @@ -1288,8 +1285,11 @@ fn bad_dependency() { error: failed to parse manifest at `[..]` Caused by: + TOML parse error at line 8, column 23 + | + 8 | bar = 3 + | ^ invalid type: integer `3`, expected a version string like [..] - in `dependencies.bar` ", ) .run(); @@ -1320,8 +1320,11 @@ fn bad_debuginfo() { error: failed to parse manifest [..] Caused by: + TOML parse error at line 8, column 25 + | + 8 | debug = 'a' + | ^^^ invalid value: string \"a\", expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\" - in `profile.dev.debug` ", ) .run(); @@ -1352,8 +1355,11 @@ fn bad_debuginfo2() { error: failed to parse manifest at `[..]` Caused by: + TOML parse error at line 8, column 25 + | + 8 | debug = 3.6 + | ^^^ invalid type: floating point `3.6`, expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\" - in `profile.dev.debug` ", ) .run(); @@ -1382,8 +1388,11 @@ fn bad_opt_level() { error: failed to parse manifest at `[..]` Caused by: - expected a boolean or a string - in `package.build` + TOML parse error at line 6, column 25 + | + 6 | build = 3 + | ^ + invalid type: integer `3`, expected a boolean or string ", ) .run(); @@ -1412,6 +1421,117 @@ fn warn_semver_metadata() { } #[cargo_test] +fn bad_http_ssl_version() { + // Invalid type in SslVersionConfig. + let p = project() + .file( + ".cargo/config.toml", + r#" + [http] + ssl-version = ["tlsv1.2", "tlsv1.3"] + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] error in [..]/config.toml: could not load config key `http.ssl-version` + +Caused by: + invalid type: sequence, expected a string or map +", + ) + .run(); +} + +#[cargo_test] +fn bad_http_ssl_version_range() { + // Invalid type in SslVersionConfigRange. + let p = project() + .file( + ".cargo/config.toml", + r#" + [http] + ssl-version.min = false + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] error in [..]/config.toml: could not load config key `http.ssl-version` + +Caused by: + error in [..]/config.toml: `http.ssl-version.min` expected a string, but found a boolean +", + ) + .run(); +} + +#[cargo_test] +fn bad_build_jobs() { + // Invalid type in JobsConfig. + let p = project() + .file( + ".cargo/config.toml", + r#" + [build] + jobs = { default = true } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] error in [..]/config.toml: could not load config key `build.jobs` + +Caused by: + invalid type: map, expected an integer or string +", + ) + .run(); +} + +#[cargo_test] +fn bad_build_target() { + // Invalid type in BuildTargetConfig. + let p = project() + .file( + ".cargo/config.toml", + r#" + [build] + target.'cfg(unix)' = "x86_64" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("check") + .with_status(101) + .with_stderr( + "\ +[ERROR] error in [..]/config.toml: could not load config key `build.target` + +Caused by: + error in [..]/config.toml: could not load config key `build.target` + +Caused by: + invalid type: map, expected a string or array +", + ) + .run(); +} + +#[cargo_test] fn bad_target_cfg() { // Invalid type in a StringList. // |