-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from rust-lang-ar/stage4_tests
added stage4 tests
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 @@ | ||
#![cfg(feature = "stage4")] | ||
|
||
mod helpers; | ||
|
||
use helpers::{split_ls_column_output, split_ls_output_by_newline}; | ||
use rstest::rstest; | ||
use std::process::Command; | ||
|
||
const EXPECTED_HELP_TEXT: &str = r#"A tiny version of ls command | ||
Usage: oxidar-ls [OPTIONS] <PATH> | ||
Arguments: | ||
<PATH> Path to list | ||
Options: | ||
-a, --all Show hidden files | ||
-F, --format Format file names. Appendds a symbol at the end indicating the type of file. Slash ('/') is for directories and at sign ('@') is for symbolic links | ||
-l, --list Show the files in a list | ||
-h, --human Show the file size in a human-redable format | ||
--help | ||
"#; | ||
|
||
#[rstest] | ||
#[case::arguments_help(&["--help"])] | ||
fn test_stage_4(#[case] ls_arguments: &[&'static str]) { | ||
let output = Command::new("./target/debug/oxidar-ls") | ||
.args([ls_arguments, &["./test_dir"]].concat()) | ||
.output() | ||
.expect("failed to execute process"); | ||
|
||
assert!(output.status.success()); | ||
|
||
assert_eq!( | ||
EXPECTED_HELP_TEXT, | ||
std::str::from_utf8(&output.stdout).unwrap() | ||
); | ||
} |
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