on master help sign in
Tests ~ add predicate normalization for tests using `echo`
commit4840c7cd78910d54a7959d8d0d4187ca84d90c2d authorRoy Ivy III <rivy.dev@gmail.com> dateThu 28 May 2020, 09:43 (6 years ago) parent71ab4a2
2 files changed+6−4
Cargo.toml+1 tests/integration_tests.rs+5−4
Cargo.toml+1
@@ -76,6 +76,7 @@ default-features = false
7676[dev-dependencies]
7777tempdir = "0.3"
7878assert_cmd = "1.0.1"
79+predicates = "1.0.4"
7980
8081[build-dependencies]
8182clap = { version = "2.33", optional = true }
tests/integration_tests.rs+5−4
@@ -1,4 +1,5 @@
11use assert_cmd::Command;
2+use predicates::{prelude::predicate,str::PredicateStrExt};
23use std::path::Path;
34use std::str::from_utf8;
45
@@ -454,7 +455,7 @@ fn pager_basic() {
454455 println!("stdout={:#?}", stdout);
455456 assert
456457 .success()
457− .stdout("pager-output\n");
458+ .stdout(predicate::eq("pager-output\n").normalize());
458459}
459460
460461#[test]
@@ -469,7 +470,7 @@ fn pager_overwrite() {
469470 println!("stdout={:#?}", stdout);
470471 assert
471472 .success()
472− .stdout("pager-output\n");
473+ .stdout(predicate::eq("pager-output\n").normalize());
473474}
474475
475476#[test]
@@ -484,7 +485,7 @@ fn pager_disable() {
484485 println!("stdout={:#?}", stdout);
485486 assert
486487 .success()
487− .stdout("hello world\n");
488+ .stdout(predicate::eq("hello world\n").normalize());
488489}
489490
490491#[test]
@@ -510,7 +511,7 @@ fn config_read_arguments_from_file() {
510511 println!("stdout={:#?}", stdout);
511512 assert
512513 .success()
513− .stdout("dummy-pager-from-config\n");
514+ .stdout(predicate::eq("dummy-pager-from-config\n").normalize());
514515}
515516
516517#[test]