-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support multi-line doc close #97 * update test
- Loading branch information
Showing
8 changed files
with
133 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
source: tests/wrap_test.rs | ||
expression: output | ||
--- | ||
RUN | ||
prog foo -h | ||
|
||
OUTPUT | ||
cat >&2 <<-'EOF' | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu cursus euismod quis viverra. | ||
|
||
Extra lines after the @cmd or @describe, which don't start with an @, are | ||
treated as the long description. A line which is not a comment ends | ||
the block. | ||
|
||
USAGE: prog foo | ||
|
||
EOF | ||
exit 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
macro_rules! snapshort_wrap { | ||
($source:expr, $width:expr) => { | ||
let args: Vec<String> = vec!["prog --help".into()]; | ||
let values = argc::eval(None, $source, &args, Some($width)).unwrap(); | ||
let output = argc::ArgcValue::to_shell(values); | ||
insta::assert_snapshot!(output); | ||
}; | ||
} | ||
const SCRIPT: &str = r###" | ||
# @describe A simple cli | ||
# | ||
# Extra lines after the @cmd or @describe, which don't start with an @, are | ||
# treated as the long description. A line which is not a comment ends | ||
# the block. | ||
#[test] | ||
fn test_wrap() { | ||
let script: &str = r###" | ||
# @option --foo Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Neque laoreet suspendisse libero id. | ||
# * default: enables recommended style components (default). | ||
# * full: enables all available components. | ||
# * auto: same as 'default', unless the output is piped. | ||
# @arg target Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Sed viverra tellus in hac habitasse platea. | ||
# Use '-' for standard input. | ||
# @cmd Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Arcu cursus euismod quis viverra. | ||
# | ||
# Extra lines after the @cmd or @describe, which don't start with an @, are | ||
# treated as the long description. A line which is not a comment ends | ||
# the block. | ||
foo() { | ||
} | ||
"###; | ||
snapshort_wrap!(script, 80); | ||
|
||
#[test] | ||
fn test_wrap() { | ||
snapshot!(None, SCRIPT, &["prog", "-h"], Some(80)); | ||
} | ||
|
||
#[test] | ||
fn test_wrap2() { | ||
snapshot!(None, SCRIPT, &["prog", "foo", "-h"], Some(80)); | ||
} |