forge
Explore
Log in

Don't you dare go Hollow

layout/tests: Extract check_ops_on_layout()

Browse files at this commit

54076b76321f47fd1485ec3183373a55da5a641eIvan MolodetskikhParent: c9873a0
src/layout/tests.rsmodified+9 -9
@@ -1479,24 +1479,24 @@ impl Op {
1479 }1479 }
1480 1480
1481 #[track_caller]1481 #[track_caller]
1482-fn check_ops(ops: &[Op]) -> Layout<TestWindow> {1482+fn check_ops_on_layout(layout: &mut Layout<TestWindow>, ops: &[Op]) {
1483- let mut layout = Layout::default();
1484 for op in ops {1483 for op in ops {
1485- op.apply(&mut layout);1484+ op.apply(layout);
1486 layout.verify_invariants();1485 layout.verify_invariants();
1487 }1486 }
1487+}
1488+
1489+#[track_caller]
1490+fn check_ops(ops: &[Op]) -> Layout<TestWindow> {
1491+ let mut layout = Layout::default();
1492+ check_ops_on_layout(&mut layout, ops);
1488 layout1493 layout
1489 }1494 }
1490 1495
1491 #[track_caller]1496 #[track_caller]
1492 fn check_ops_with_options(options: Options, ops: &[Op]) -> Layout<TestWindow> {1497 fn check_ops_with_options(options: Options, ops: &[Op]) -> Layout<TestWindow> {
1493 let mut layout = Layout::with_options(Clock::with_time(Duration::ZERO), options);1498 let mut layout = Layout::with_options(Clock::with_time(Duration::ZERO), options);
1494-1499+ check_ops_on_layout(&mut layout, ops);
1495- for op in ops {
1496- op.apply(&mut layout);
1497- layout.verify_invariants();
1498- }
1499-
1500 layout1500 layout
1501 }1501 }
1502 1502