From 2c814a43c3751f39a0d1c0e613f51d787bdee74f Mon Sep 17 00:00:00 2001 From: Vivek Date: Wed, 29 Jan 2025 20:09:33 -0600 Subject: [PATCH] returned accidentally removed tests --- crates/nu-command/src/path/relative_to.rs | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/nu-command/src/path/relative_to.rs b/crates/nu-command/src/path/relative_to.rs index 9f1c8de77e..b7bc5dad87 100644 --- a/crates/nu-command/src/path/relative_to.rs +++ b/crates/nu-command/src/path/relative_to.rs @@ -92,6 +92,30 @@ path."# ) } + #[cfg(windows)] + fn examples(&self) -> Vec { + vec![ + Example { + description: "Find a relative path from two absolute paths", + example: r"'C:\Users\viking' | path relative-to 'C:\Users'", + result: Some(Value::test_string(r"viking")), + }, + Example { + description: "Find a relative path from absolute paths in list", + example: r"[ C:\Users\viking, C:\Users\spam ] | path relative-to C:\Users", + result: Some(Value::test_list(vec![ + Value::test_string("viking"), + Value::test_string("spam"), + ])), + }, + Example { + description: "Find a relative path from two relative paths", + example: r"'eggs\bacon\sausage\spam' | path relative-to 'eggs\bacon\sausage'", + result: Some(Value::test_string(r"spam")), + }, + ] + } + #[cfg(not(windows))] fn examples(&self) -> Vec { vec![