From df09cb96039b1e8791a6e722e6cb78c02a8d3fe5 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Fri, 16 Aug 2024 10:58:12 +0200 Subject: [PATCH] test: Add test for invalid environment names --- crates/pixi_manifest/src/parsed_manifest.rs | 1 + ...pixi_manifest__parsed_manifest__tests__invalid_key.snap | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/pixi_manifest/src/parsed_manifest.rs b/crates/pixi_manifest/src/parsed_manifest.rs index c9b1e9505..c42d6d9a9 100644 --- a/crates/pixi_manifest/src/parsed_manifest.rs +++ b/crates/pixi_manifest/src/parsed_manifest.rs @@ -560,6 +560,7 @@ mod tests { let examples = [ format!("{PROJECT_BOILERPLATE}\n[foobar]"), format!("{PROJECT_BOILERPLATE}\n[target.win-64.hostdependencies]"), + format!("{PROJECT_BOILERPLATE}\n[environments.INVALID]"), ]; assert_snapshot!(examples .into_iter() diff --git a/crates/pixi_manifest/src/snapshots/pixi_manifest__parsed_manifest__tests__invalid_key.snap b/crates/pixi_manifest/src/snapshots/pixi_manifest__parsed_manifest__tests__invalid_key.snap index cea898dea..4e2464b39 100644 --- a/crates/pixi_manifest/src/snapshots/pixi_manifest__parsed_manifest__tests__invalid_key.snap +++ b/crates/pixi_manifest/src/snapshots/pixi_manifest__parsed_manifest__tests__invalid_key.snap @@ -1,6 +1,5 @@ --- source: crates/pixi_manifest/src/parsed_manifest.rs -assertion_line: 515 expression: "examples.into_iter().map(|example|\n ParsedManifest::from_toml_str(&example).unwrap_err().to_string()).collect::>().join(\"\\n\")" --- TOML parse error at line 8, column 2 @@ -14,3 +13,9 @@ TOML parse error at line 8, column 16 8 | [target.win-64.hostdependencies] | ^^^^^^^^^^^^^^^^ unknown field `hostdependencies`, expected one of `dependencies`, `host-dependencies`, `build-dependencies`, `pypi-dependencies`, `activation`, `tasks` + +TOML parse error at line 8, column 15 + | +8 | [environments.INVALID] + | ^^^^^^^ +Failed to parse environment name 'INVALID', please use only lowercase letters, numbers and dashes