coverage: Migrate tests/run-coverage
into tests/coverage
This commit is contained in:
parent
aea7c27eae
commit
e9d04c5e24
105 changed files with 7 additions and 9 deletions
37
tests/coverage/yield.rs
Normal file
37
tests/coverage/yield.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#![feature(coroutines, coroutine_trait)]
|
||||
#![allow(unused_assignments)]
|
||||
|
||||
use std::ops::{Coroutine, CoroutineState};
|
||||
use std::pin::Pin;
|
||||
|
||||
fn main() {
|
||||
let mut coroutine = || {
|
||||
yield 1;
|
||||
return "foo";
|
||||
};
|
||||
|
||||
match Pin::new(&mut coroutine).resume(()) {
|
||||
CoroutineState::Yielded(1) => {}
|
||||
_ => panic!("unexpected value from resume"),
|
||||
}
|
||||
match Pin::new(&mut coroutine).resume(()) {
|
||||
CoroutineState::Complete("foo") => {}
|
||||
_ => panic!("unexpected value from resume"),
|
||||
}
|
||||
|
||||
let mut coroutine = || {
|
||||
yield 1;
|
||||
yield 2;
|
||||
yield 3;
|
||||
return "foo";
|
||||
};
|
||||
|
||||
match Pin::new(&mut coroutine).resume(()) {
|
||||
CoroutineState::Yielded(1) => {}
|
||||
_ => panic!("unexpected value from resume"),
|
||||
}
|
||||
match Pin::new(&mut coroutine).resume(()) {
|
||||
CoroutineState::Yielded(2) => {}
|
||||
_ => panic!("unexpected value from resume"),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue