diff options
author | Roman Proskuryakov <humbug@deeptown.org> | 2017-03-31 00:13:07 +0300 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2017-03-31 14:44:13 -0400 |
commit | aed3ccb9c7392e3f075baa38214107dd80e9cc9e (patch) | |
tree | 947520f5b2d4cf7867241fed024068b13ef14c55 /tests | |
parent | 33c95d2919cb3ecdcd78991690f31bd2631008ab (diff) |
Improves Printer, fixes some bugs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tests.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 1d0964b7..9457f452 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1057,6 +1057,33 @@ clean!(regression_405, "test", ".", |wd: WorkDir, mut cmd: Command| { assert_eq!(lines, format!("{}:test\n", path("bar/foo/file2.txt"))); }); +// See: https://github.com/BurntSushi/ripgrep/issues/428 +clean!(regression_428_color_context_path, "foo", ".", |wd: WorkDir, mut cmd: Command| { + wd.create("sherlock", "foo\nbar"); + cmd.arg("-A1").arg("-H").arg("--no-heading").arg("-N") + .arg("--colors=match:none").arg("--color=always"); + + let lines: String = wd.stdout(&mut cmd); + let expected = format!("\ +{colored_path}:foo +{colored_path}-bar +", colored_path=format!("\x1b\x5b\x6d\x1b\x5b\x33\x35\x6d{path}\x1b\x5b\x6d", path=path("sherlock"))); + assert_eq!(lines, expected); +}); + +// See: https://github.com/BurntSushi/ripgrep/issues/428 +clean!(regression_428_unrecognized_style, "Sherlok", ".", |wd: WorkDir, mut cmd: Command| { + cmd.arg("--colors=match:style:"); + wd.assert_err(&mut cmd); + + let output = cmd.output().unwrap(); + let err = String::from_utf8_lossy(&output.stderr); + let expected = "\ +Unrecognized style attribute ''. Choose from: nobold, bold, nointense, intense. +"; + assert_eq!(err, expected); +}); + // See: https://github.com/BurntSushi/ripgrep/issues/1 clean!(feature_1_sjis, "Шерлок Холмс", ".", |wd: WorkDir, mut cmd: Command| { let sherlock = |