Skip to content

Commit

Permalink
Add integration tests for merging styles
Browse files Browse the repository at this point in the history
  • Loading branch information
eth-p committed Apr 7, 2024
1 parent 9a9bfa4 commit 7440354
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2631,3 +2631,62 @@ fn highlighting_independant_from_map_syntax_case() {
.stdout(expected)
.stderr("");
}

// Tests that style components can be removed with `-component`.
#[test]
fn style_components_can_be_removed() {
bat()
.arg("--style=full,-grid")
.arg("--decorations=always")
.arg("--color=never")
.write_stdin("test")
.assert()
.success()
.stdout(" STDIN\n Size: -\n 1 test\n")
.stderr("");
}

// Tests that style components are chosen based on the rightmost `--style` argument.
#[test]
fn style_components_can_be_overidden() {
bat()
.arg("--style=full")
.arg("--style=header,numbers")
.arg("--decorations=always")
.arg("--color=never")
.write_stdin("test")
.assert()
.success()
.stdout(" STDIN\n 1 test\n")
.stderr("");
}

// Tests that style components can be merged across multiple `--style` arguments.
#[test]
fn style_components_will_merge() {
bat()
.arg("--style=header,grid")
.arg("--style=-grid,+numbers")
.arg("--decorations=always")
.arg("--color=never")
.write_stdin("test")
.assert()
.success()
.stdout(" STDIN\n 1 test\n")
.stderr("");
}

// Tests that style components can be merged with the `BAT_STYLE` environment variable.
#[test]
fn style_components_will_merge_with_env_var() {
bat()
.env("BAT_STYLE", "header,grid")
.arg("--style=-grid,+numbers")
.arg("--decorations=always")
.arg("--color=never")
.write_stdin("test")
.assert()
.success()
.stdout(" STDIN\n 1 test\n")
.stderr("");
}

0 comments on commit 7440354

Please sign in to comment.