Skip to content

Commit 977d2fe

Browse files
committed
fix(test): use platform-specific paths in test_validate_command_nonexistent
Use Windows-style path on Windows (C:\...) and Unix-style path on Unix (/.../), fixing Windows test failure where Unix-style absolute path was not recognized as valid on Windows. Fixes: command::tests::test_validate_command_nonexistent on Windows CI All 352 tests passing.
1 parent b0c3309 commit 977d2fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/mcp-core/src/command.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ mod tests {
196196

197197
#[test]
198198
fn test_validate_command_nonexistent() {
199-
let result = validate_command("/absolutely/nonexistent/path/to/server");
199+
#[cfg(unix)]
200+
let nonexistent_path = "/absolutely/nonexistent/path/to/server";
201+
#[cfg(windows)]
202+
let nonexistent_path = "C:\\absolutely\\nonexistent\\path\\to\\server.exe";
203+
204+
let result = validate_command(nonexistent_path);
200205
assert!(result.is_err());
201206
if let Err(Error::SecurityViolation { reason }) = result {
202207
assert!(reason.contains("does not exist"));

0 commit comments

Comments
 (0)