Progress
This commit is contained in:
41
src/tests/term.rs
Normal file
41
src/tests/term.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use libsh::term::{Style, StyleSet, Styled};
|
||||
|
||||
use super::super::*;
|
||||
#[test]
|
||||
fn styled_simple() {
|
||||
let input = "hello world";
|
||||
let styled = input.styled(Style::Green);
|
||||
|
||||
insta::assert_snapshot!(styled)
|
||||
}
|
||||
#[test]
|
||||
fn styled_multiple() {
|
||||
let input = "styled text";
|
||||
let styled = input.styled(Style::Red | Style::Bold | Style::Underline);
|
||||
insta::assert_snapshot!(styled);
|
||||
}
|
||||
#[test]
|
||||
fn styled_rgb() {
|
||||
let input = "RGB styled text";
|
||||
let styled = input.styled(Style::RGB(255, 99, 71)); // Tomato color
|
||||
insta::assert_snapshot!(styled);
|
||||
}
|
||||
#[test]
|
||||
fn styled_background() {
|
||||
let input = "text with background";
|
||||
let styled = input.styled(Style::BgBlue | Style::Bold);
|
||||
insta::assert_snapshot!(styled);
|
||||
}
|
||||
#[test]
|
||||
fn styled_set() {
|
||||
let input = "multi-style text";
|
||||
let style_set = StyleSet::new().add(Style::Magenta).add(Style::Italic);
|
||||
let styled = input.styled(style_set);
|
||||
insta::assert_snapshot!(styled);
|
||||
}
|
||||
#[test]
|
||||
fn styled_reset() {
|
||||
let input = "reset test";
|
||||
let styled = input.styled(Style::Bold | Style::Reset);
|
||||
insta::assert_snapshot!(styled);
|
||||
}
|
||||
Reference in New Issue
Block a user