Skip to content

Commit

Permalink
Update unit test new subword highlighting heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Jul 12, 2023
1 parent 5606c04 commit f6ceb2a
Showing 1 changed file with 86 additions and 6 deletions.
92 changes: 86 additions & 6 deletions src/parse/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,18 +1180,18 @@ mod tests {

#[test]
fn test_split_atom_words() {
let content = "abc def";
let content = "abc def ghi novel";
let pos = vec![SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 7,
end_col: 17,
}];

let opposite_content = "abc";
let opposite_content = "abc def ghi";
let opposite_pos = vec![SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 3,
end_col: 11,
}];

let res = split_atom_words(
Expand Down Expand Up @@ -1222,19 +1222,99 @@ mod tests {
line: 0.into(),
start_col: 0,
end_col: 3
}
},
MatchedPos {
kind: MatchKind::NovelLinePart {
highlight: TokenKind::Atom(AtomKind::Comment),
self_pos: SingleLineSpan {
line: 0.into(),
start_col: 3,
end_col: 4
},
opposite_pos: vec![SingleLineSpan {
line: 0.into(),
start_col: 3,
end_col: 4
}]
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 3,
end_col: 4
}
},
MatchedPos {
kind: MatchKind::NovelWord {
kind: MatchKind::NovelLinePart {
highlight: TokenKind::Atom(AtomKind::Comment),
self_pos: SingleLineSpan {
line: 0.into(),
start_col: 4,
end_col: 7
},
opposite_pos: vec![SingleLineSpan {
line: 0.into(),
start_col: 4,
end_col: 7
}]
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 4,
end_col: 7
}
},
MatchedPos {
kind: MatchKind::NovelLinePart {
highlight: TokenKind::Atom(AtomKind::Comment),
self_pos: SingleLineSpan {
line: 0.into(),
start_col: 7,
end_col: 8
},
opposite_pos: vec![SingleLineSpan {
line: 0.into(),
start_col: 7,
end_col: 8
}]
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 7,
end_col: 8
}
},
]
MatchedPos {
kind: MatchKind::NovelLinePart {
highlight: TokenKind::Atom(AtomKind::Comment),
self_pos: SingleLineSpan {
line: 0.into(),
start_col: 8,
end_col: 11
},
opposite_pos: vec![SingleLineSpan {
line: 0.into(),
start_col: 8,
end_col: 11
}]
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 8,
end_col: 11
}
},
MatchedPos {
kind: MatchKind::NovelWord {
highlight: TokenKind::Atom(AtomKind::Comment)
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 12,
end_col: 17
}
}
],
);
}

Expand Down

0 comments on commit f6ceb2a

Please sign in to comment.