MCPcopy Create free account
hub / github.com/Windfisch/rust-assert-no-alloc / unwind_nested2

Function unwind_nested2

tests/test.rs:127–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125
126#[test]
127fn unwind_nested2() {
128 assert_eq!(check_and_reset(), false);
129 assert_no_alloc(|| {
130 assert_no_alloc(|| {
131 let r = catch_unwind(|| {
132 assert_no_alloc(|| {
133 assert_no_alloc(|| {
134 panic!();
135 });
136 });
137 });
138 assert!(r.is_err());
139
140 check_and_reset(); // unwinding might have allocated memory; we don't care about that.
141 do_alloc();
142 assert_eq!(check_and_reset(), true);
143 });
144 });
145 check_and_reset(); // unwinding might have allocated memory; we don't care about that.
146 do_alloc();
147 assert_eq!(check_and_reset(), false);
148}

Callers

nothing calls this directly

Calls 3

assert_no_allocFunction · 0.85
check_and_resetFunction · 0.85
do_allocFunction · 0.85

Tested by

no test coverage detected