Skip to content

Commit

Permalink
Rebrand new style to "experimental"
Browse files Browse the repository at this point in the history
And don't give it any tests.
  • Loading branch information
walles committed Oct 21, 2024
1 parent 8f66c8f commit dbda95b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ pub(crate) enum UnchangedStyle {
#[default]
None,

/// Unchanged parts are colored yellow
Yellow,
/// Try it and report back!
Experimental,
}

fn format_error(message: String, line_number: usize, line: &[u8]) -> String {
Expand Down Expand Up @@ -484,7 +484,7 @@ fn main() {

let formatter = match options.unchanged_style.unwrap_or(UnchangedStyle::None) {
UnchangedStyle::None => Formatter::default(),
UnchangedStyle::Yellow => Formatter::yellow(),
UnchangedStyle::Experimental => Formatter::experimental(),
};

if let (Some(file1), Some(file2)) = (options.x1, options.x2) {
Expand Down Expand Up @@ -593,7 +593,7 @@ mod tests {
&mut input,
file.reopen().unwrap(),
true,
Formatter::yellow(),
Formatter::experimental(),
) {
panic!("{}", error);
}
Expand Down Expand Up @@ -761,7 +761,7 @@ mod tests {
&mut fs::File::open(input_file).unwrap(),
file.reopen().unwrap(),
true,
Formatter::yellow(),
Formatter::experimental(),
) {
return Some(ExampleFailure {
diagnostics: format!("Highlighting failed: {}", error),
Expand Down Expand Up @@ -789,7 +789,7 @@ mod tests {
&mut fs::File::open(input_file).unwrap(),
file.reopen().unwrap(),
false,
Formatter::yellow(),
Formatter::default(),
)
.unwrap();

Expand Down
5 changes: 3 additions & 2 deletions src/refiner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use similar::capture_diff_slices;
use crate::ansi::Color::Green;
use crate::ansi::Color::Red;
use crate::ansi::Color::Yellow;
use crate::ansi::Weight::Faint;
use crate::ansi::ANSI_STYLE_NORMAL;
use crate::constants::*;
use crate::line_collector::NO_EOF_NEWLINE_MARKER_HOLDER;
Expand Down Expand Up @@ -33,11 +34,11 @@ impl Formatter {
}
}

pub(crate) fn yellow() -> Self {
pub(crate) fn experimental() -> Self {
Formatter {
line_style_old: LineStyle {
prefix_style: ANSI_STYLE_NORMAL.with_color(Red),
unchanged_style: ANSI_STYLE_NORMAL.with_color(Yellow),
unchanged_style: ANSI_STYLE_NORMAL.with_color(Yellow).with_weight(Faint),
midlighted_style: ANSI_STYLE_NORMAL.with_color(Red),
highlighted_style: ANSI_STYLE_NORMAL.with_color(Red).with_inverse(true),
},
Expand Down
3 changes: 0 additions & 3 deletions src/token_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,6 @@ mod tests {
assert_eq!(rendered, format!("{GREEN}+hej{NORMAL}\n"));
}


FIXME: Why are the tests passing even though stuff is supposed to default to red / green?

#[test]
fn test_errorlight_trailing_whitespace() {
// Just a whitespace
Expand Down

0 comments on commit dbda95b

Please sign in to comment.