mirror of
https://github.com/sharkdp/bat.git
synced 2025-08-13 01:37:18 +02:00
fix: Wrap file name in header
This commit is contained in:
@ -1381,6 +1381,61 @@ fn header_full_binary() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_narrow_terminal() {
|
||||
bat()
|
||||
.arg("--terminal-width=30")
|
||||
.arg("--decorations=always")
|
||||
.arg("this-file-path-is-really-long-and-would-have-broken-the-layout-of-the-header.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"\
|
||||
───────┬──────────────────────
|
||||
│ File: this-file-path-
|
||||
│ is-really-long-and-wo
|
||||
│ uld-have-broken-the-l
|
||||
│ ayout-of-the-header.t
|
||||
│ xt
|
||||
───────┼──────────────────────
|
||||
1 │ The header is not bro
|
||||
│ ken
|
||||
───────┴──────────────────────
|
||||
",
|
||||
)
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_very_narrow_terminal() {
|
||||
bat()
|
||||
.arg("--terminal-width=10")
|
||||
.arg("--decorations=always")
|
||||
.arg("this-file-path-is-really-long-and-would-have-broken-the-layout-of-the-header.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"\
|
||||
──────────
|
||||
File: this
|
||||
-file-path
|
||||
-is-really
|
||||
-long-and-
|
||||
would-have
|
||||
-broken-th
|
||||
e-layout-o
|
||||
f-the-head
|
||||
er.txt
|
||||
──────────
|
||||
The header
|
||||
is not br
|
||||
oken
|
||||
──────────
|
||||
",
|
||||
)
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "git")] // Expected output assumes git is enabled
|
||||
fn header_default() {
|
||||
|
Reference in New Issue
Block a user