Skip to content

Commit 25af6e9

Browse files
committed
add graphrow symbol tests
1 parent 905e5ee commit 25af6e9

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

src/components/utils/graphrow.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,40 @@ pub const SYM_TEE_RIGHT: &str = "┣";
1616
pub const SYM_TEE_UP: &str = "┻";
1717
pub const SYM_TEE_DOWN: &str = "┳";
1818
pub const SYM_SPACE: &str = " ";
19+
20+
#[cfg(test)]
21+
mod tests {
22+
use super::*;
23+
24+
#[test]
25+
fn symbols_are_single_char_and_distinct() {
26+
let symbols = [
27+
SYM_COMMIT,
28+
SYM_COMMIT_BRANCH,
29+
SYM_COMMIT_MERGE,
30+
SYM_COMMIT_STASH,
31+
SYM_COMMIT_UNCOMMITTED,
32+
SYM_VERTICAL,
33+
SYM_VERTICAL_DOTTED,
34+
SYM_HORIZONTAL,
35+
SYM_MERGE_BRIDGE_START,
36+
SYM_MERGE_BRIDGE_MID,
37+
SYM_MERGE_BRIDGE_END,
38+
SYM_BRANCH_UP,
39+
SYM_BRANCH_UP_RIGHT,
40+
SYM_TEE_LEFT,
41+
SYM_TEE_RIGHT,
42+
SYM_TEE_UP,
43+
SYM_TEE_DOWN,
44+
SYM_SPACE,
45+
];
46+
47+
for symbol in symbols {
48+
assert_eq!(
49+
symbol.chars().count(),
50+
1,
51+
"{symbol:?} should be a single glyph"
52+
);
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)