From a63bb08edae661f68fc330549c27d0d43355d606 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 21 Dec 2020 17:00:14 +0100 Subject: [PATCH] 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. --- tests/integration_tests.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index d0217021..3373aa7d 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -827,3 +827,27 @@ fn plain_mode_does_not_add_nonexisting_newline() { .stdout("Single Line"); } +// Regression test for https://github.com/sharkdp/bat/issues/299 +#[test] +fn grid_for_file_without_newline() { + bat() + .arg("--paging=never") + .arg("--color=never") + .arg("--terminal-width=80") + .arg("--wrap=never") + .arg("--decorations=always") + .arg("--style=full") + .arg("single-line.txt") + .assert() + .success() + .stdout( + "\ +───────┬──────────────────────────────────────────────────────────────────────── + │ File: single-line.txt +───────┼──────────────────────────────────────────────────────────────────────── + 1 │ Single Line +───────┴──────────────────────────────────────────────────────────────────────── +", + ) + .stderr(""); +}