on master help sign in
Add test 'grid_for_file_without_newline' (for issue #299 fix)

This is a regression test for the fix for issue #299. If that fix is reverted, currently only one test ('header_padding') fails. But that test is for a different use case, so add a dedicated regression test for the particular use case issue #299 is about.

commita63bb08edae661f68fc330549c27d0d43355d606 authorMartin Nordholts <enselic@gmail.com> dateMon 21 Dec 2020, 17:00 (6 years ago) parente0207f8
1 file changed+24
tests/integration_tests.rs+24
tests/integration_tests.rs+24
@@ -827,3 +827,27 @@ fn plain_mode_does_not_add_nonexisting_newline() {
827827 .stdout("Single Line");
828828}
829829
830+// Regression test for https://github.com/sharkdp/bat/issues/299
831+#[test]
832+fn grid_for_file_without_newline() {
833+ bat()
834+ .arg("--paging=never")
835+ .arg("--color=never")
836+ .arg("--terminal-width=80")
837+ .arg("--wrap=never")
838+ .arg("--decorations=always")
839+ .arg("--style=full")
840+ .arg("single-line.txt")
841+ .assert()
842+ .success()
843+ .stdout(
844+ "\
845+───────┬────────────────────────────────────────────────────────────────────────
846+ │ File: single-line.txt
847+───────┼────────────────────────────────────────────────────────────────────────
848+ 1 │ Single Line
849+───────┴────────────────────────────────────────────────────────────────────────
850+",
851+ )
852+ .stderr("");
853+}