From 8412c6d66eb243d5772f6ac7586e3f265c380f1e Mon Sep 17 00:00:00 2001 From: A Farzat Date: Sat, 20 Jun 2026 13:07:25 +0300 Subject: Add double dash tests to r2md append & prepend --- src/bin/r2md-append.rs | 19 +++++++++++++++++++ src/bin/r2md-prepend.rs | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/bin/r2md-append.rs b/src/bin/r2md-append.rs index 4cd2ae9..4dd0698 100644 --- a/src/bin/r2md-append.rs +++ b/src/bin/r2md-append.rs @@ -47,4 +47,23 @@ mod tests { vec![OsString::from("README.md"), OsString::from("src/main.rs")] ); } + + #[test] + fn treats_arguments_after_double_dash_as_paths() { + let cli = Cli::try_parse_from([ + "r2md-append", + "--", + "--filename-that-looks-like-an-option", + "main.rs", + ]) + .unwrap(); + + assert_eq!( + cli.paths, + vec![ + OsString::from("--filename-that-looks-like-an-option"), + OsString::from("main.rs") + ] + ); + } } diff --git a/src/bin/r2md-prepend.rs b/src/bin/r2md-prepend.rs index 2649587..7297fb6 100644 --- a/src/bin/r2md-prepend.rs +++ b/src/bin/r2md-prepend.rs @@ -47,4 +47,23 @@ mod tests { vec![OsString::from("README.md"), OsString::from("src/main.rs")] ); } + + #[test] + fn treats_arguments_after_double_dash_as_paths() { + let cli = Cli::try_parse_from([ + "r2md-prepend", + "--", + "--filename-that-looks-like-an-option", + "main.rs", + ]) + .unwrap(); + + assert_eq!( + cli.paths, + vec![ + OsString::from("--filename-that-looks-like-an-option"), + OsString::from("main.rs") + ] + ); + } } -- cgit v1.3.1