1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Restructure and fix bug in line range module

This commit is contained in:
sharkdp
2020-03-21 17:22:17 +01:00
committed by David Peter
parent 4855a47105
commit fedd32173e
4 changed files with 62 additions and 20 deletions

View File

@@ -68,7 +68,7 @@ impl Default for PagingMode {
}
use inputfile::InputFile;
use line_range::LineRanges;
use line_range::{LineRanges, HighlightedLineRanges};
use style::{OutputComponents, OutputWrap};
use syntax_mapping::SyntaxMapping;
@@ -123,6 +123,20 @@ pub struct Config<'a> {
/// Whether or not to use ANSI italics
pub use_italic_text: bool,
/// Lines to highlight
pub highlight_lines: LineRanges,
/// Ranges of lines which should be highlighted with a special background color
pub highlighted_lines: HighlightedLineRanges,
}
#[test]
fn default_config_should_include_all_lines() {
use line_range::RangeCheckResult;
assert_eq!(Config::default().line_ranges.check(17), RangeCheckResult::InRange);
}
#[test]
fn default_config_should_highlight_no_lines() {
use line_range::RangeCheckResult;
assert_ne!(Config::default().highlighted_lines.0.check(17), RangeCheckResult::InRange);
}