Skip to content

Commit

Permalink
testing: Add manual instance test for Style
Browse files Browse the repository at this point in the history
PR nushell#43 introduced a pub(crate) field in Style which broke the
intended API (See: Issue nushell#46). Introduce a new test which will fail in those
cases since it won't be able to initialize pub(crate) fields.

Inspired by: nushell#46 (comment)
  • Loading branch information
Matt Helsley committed Jun 24, 2023
1 parent f2593a0 commit ac5cebb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/style.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use nu_ansi_term::Style;

#[test]
fn manual_instance_style() {
let s = Style { ..Style::default() };
assert_eq!(Style::default(), s);

let s = Style {
is_underline: false,
..Style::default()
};
assert_eq!(Style::default(), s);

let s = Style {
foreground: None,
background: None,
is_bold: false,
is_dimmed: false,
is_italic: false,
is_underline: false,
is_blink: false,
is_reverse: false,
is_hidden: false,
is_strikethrough: false,
with_reset: false,
};
assert_eq!(Style::default(), s);
}

0 comments on commit ac5cebb

Please sign in to comment.