Skip to content

Commit

Permalink
Add regression test for sharkdp#2541
Browse files Browse the repository at this point in the history
More specifically, the test ensures that OSC sequences don't end up
wrapping the line.
  • Loading branch information
eth-p committed Apr 17, 2023
1 parent c981895 commit 24f56ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/examples/regression_tests/issue_2541.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
]8;;http://example.com\This is a link]8;;\n
17 changes: 17 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use predicates::boolean::PredicateBooleanExt;
use predicates::{prelude::predicate, str::PredicateStrExt};
use serial_test::serial;
use std::io::BufRead;
use std::path::Path;
use std::str::from_utf8;
use tempfile::tempdir;
Expand Down Expand Up @@ -1067,6 +1068,22 @@ fn bom_stripped_when_no_color_and_not_loop_through() {
);
}

// Regression test for https://github.com/sharkdp/bat/issues/2541
#[test]
fn no_broken_osc_emit_with_line_wrapping() {
bat()
.arg("--color=always")
.arg("--decorations=never")
.arg("--wrap=character")
.arg("--terminal-width=40")
.arg("regression_tests/issue_2541.txt")
.assert()
.success()
.stdout(
predicate::function(|s: &str| s.lines().count() == 1)
);
}

#[test]
fn can_print_file_named_cache() {
bat_with_config()
Expand Down

0 comments on commit 24f56ae

Please sign in to comment.