more unit tests, better highlighting

This commit is contained in:
2025-05-13 20:22:25 -04:00
parent de6e0166c5
commit 6006244739
10 changed files with 223 additions and 28 deletions

27
src/tests/highlight.rs Normal file
View File

@@ -0,0 +1,27 @@
use insta::assert_snapshot;
use crate::prompt::highlight::FernHighlighter;
use super::super::*;
#[test]
fn highlight_simple() {
let line = "echo foo bar";
let styled = FernHighlighter::new(line.to_string()).hl_input();
assert_snapshot!(styled)
}
#[test]
fn highlight_cmd_sub() {
let line = "echo foo $(echo bar)";
let styled = FernHighlighter::new(line.to_string()).hl_input();
assert_snapshot!(styled)
}
#[test]
fn highlight_cmd_sub_in_dquotes() {
let line = "echo \"foo $(echo bar) biz\"";
let styled = FernHighlighter::new(line.to_string()).hl_input();
assert_snapshot!(styled)
}