MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_break_stops_after_upcall

Function test_break_stops_after_upcall

std/src/exec.rs:188–214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186
187 #[test]
188 fn test_break_stops_after_upcall() {
189 let (tx, rx) = async_channel::unbounded();
190 let break_tx = tx.clone();
191 let datetime = Rc::from(MockDateTime::default());
192 datetime.set_sleep_fn(Box::new(
193 move |_d: Duration| -> futures_lite::future::BoxedLocal<Result<(), String>> {
194 let break_tx = break_tx.clone();
195 async move {
196 break_tx.send(Signal::Break).await.unwrap();
197 Ok(())
198 }
199 .boxed_local()
200 },
201 ));
202
203 let mut machine = MachineBuilder::default()
204 .with_signals_chan((tx.clone(), rx))
205 .with_datetime(datetime)
206 .build();
207 machine.compile(&mut "DO: SLEEP 0: LOOP".as_bytes()).unwrap();
208
209 match block_on(machine.exec()) {
210 Err(Error::Break) => (),
211 r => panic!("Expected Break but got {:?}", r),
212 }
213 assert_eq!(0, tx.len());
214 }
215
216 #[test]
217 fn test_yielder_called_on_stop_reason_yield() {

Callers

nothing calls this directly

Calls 7

set_sleep_fnMethod · 0.80
with_datetimeMethod · 0.80
with_signals_chanMethod · 0.80
as_bytesMethod · 0.80
buildMethod · 0.45
compileMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected