Algo de formato
This commit is contained in:
parent
04565cb844
commit
f88b2601d4
|
@ -21,6 +21,10 @@ fn main() {
|
|||
.get_matches();
|
||||
// OJO: unwrap es seguro de llamar porque 'text' está forzado en tener al menos un valor
|
||||
let text = matches.values_of_lossy("text").unwrap();
|
||||
let ending = if matches.is_present("omit_newline") { "" } else { "\n"};
|
||||
let ending = if matches.is_present("omit_newline") {
|
||||
""
|
||||
} else {
|
||||
"\n"
|
||||
};
|
||||
print!("{}{}", text.join(" "), ending);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
use std::fs;
|
||||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
use std::fs;
|
||||
|
||||
type TestResult = Result<(), Box<dyn std::error::Error>>;
|
||||
|
||||
fn run(args: &[&str], expected_file: &str) -> TestResult {
|
||||
let expected = fs::read_to_string(format!("{}{}", "tests/expected/", expected_file))?;
|
||||
Command::cargo_bin("echor")?.args(args).assert().success().stdout(expected);
|
||||
Command::cargo_bin("echor")?
|
||||
.args(args)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(expected);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue