Skip to content

Commit

Permalink
Reintroduce bool return value, will be used in the next commit
Browse files Browse the repository at this point in the history
Created using spr 1.3.4
  • Loading branch information
sunshowers committed Sep 28, 2023
1 parent 7663d06 commit e360e1f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions update-engine/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ mod tests {
"all events passed in",
|buffer, event| {
buffer.add_event(event.clone());
true
},
WithDeltas::No,
)
Expand All @@ -1402,8 +1403,9 @@ mod tests {
|buffer, event| match event {
Event::Step(event) => {
buffer.add_step_event(event.clone());
true
}
Event::Progress(_) => {}
Event::Progress(_) => false,
},
WithDeltas::Both,
)
Expand All @@ -1416,11 +1418,13 @@ mod tests {
Event::Step(event) => match event.kind.priority() {
StepEventPriority::High => {
buffer.add_step_event(event.clone());
true
}
StepEventPriority::Low => {}
StepEventPriority::Low => false,
},
Event::Progress(event) => {
buffer.add_progress_event(event.clone());
true
}
},
WithDeltas::Both,
Expand All @@ -1434,11 +1438,13 @@ mod tests {
Event::Step(event) => match event.kind.priority() {
StepEventPriority::High => {
buffer.add_step_event(event.clone());
true
}
StepEventPriority::Low => {}
StepEventPriority::Low => false,
},
Event::Progress(_) => {
// Don't add progress events.
false
}
},
WithDeltas::Both,
Expand Down Expand Up @@ -1570,7 +1576,10 @@ mod tests {
fn run_filtered_test(
&self,
event_fn_description: &str,
mut event_fn: impl FnMut(&mut EventBuffer<TestSpec>, &Event<TestSpec>),
mut event_fn: impl FnMut(
&mut EventBuffer<TestSpec>,
&Event<TestSpec>,
) -> bool,
with_deltas: WithDeltas,
) -> anyhow::Result<()> {
match with_deltas {
Expand All @@ -1595,7 +1604,10 @@ mod tests {

fn run_filtered_test_inner(
&self,
mut event_fn: impl FnMut(&mut EventBuffer<TestSpec>, &Event<TestSpec>),
mut event_fn: impl FnMut(
&mut EventBuffer<TestSpec>,
&Event<TestSpec>,
) -> bool,
with_deltas: bool,
) -> anyhow::Result<()> {
let description = format!("with deltas = {with_deltas}");
Expand All @@ -1613,7 +1625,8 @@ mod tests {
let mut last_seen_opt = with_deltas.then_some(None);

for (i, event) in self.generated_events.iter().enumerate() {
(event_fn)(&mut buffer, event);
// Going to use event_added in an upcoming commit.
let _event_added = (event_fn)(&mut buffer, event);

let report = match last_seen_opt {
Some(last_seen) => buffer.generate_report_since(last_seen),
Expand Down

0 comments on commit e360e1f

Please sign in to comment.