Skip to content

Commit

Permalink
fixing broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
sminez committed Nov 13, 2024
1 parent 2f718ec commit 6385ac5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/ad_event/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ impl FsysEvent {
/// The `txt` field of events is limited to [MAX_CHARS] or up until the first newline character
/// and will be truncated if larger. Delete events are always truncated to zero length.
pub fn new(source: Source, kind: Kind, ch_from: usize, ch_to: usize, raw_txt: &str) -> Self {
let txt = match kind {
Kind::DeleteTag | Kind::DeleteBody => String::new(),
_ => raw_txt.chars().take(MAX_CHARS).collect(),
let (txt, truncated) = match kind {
Kind::DeleteTag | Kind::DeleteBody => (String::new(), true),
_ => {
let txt = raw_txt.chars().take(MAX_CHARS).collect();
let truncated = txt != raw_txt;

(txt, truncated)
}
};
let truncated = txt != raw_txt;

Self {
source,
Expand Down

0 comments on commit 6385ac5

Please sign in to comment.