Add a basic test for gen fn
This commit is contained in:
parent
f29b36d03e
commit
3887b1645a
18
tests/ui/coroutine/gen_fn_iter.rs
Normal file
18
tests/ui/coroutine/gen_fn_iter.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// edition: 2024
|
||||
// compile-flags: -Zunstable-options
|
||||
// run-pass
|
||||
#![feature(gen_blocks)]
|
||||
|
||||
gen fn foo() -> i32 {
|
||||
yield 1;
|
||||
yield 2;
|
||||
yield 3;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut iter = foo();
|
||||
assert_eq!(iter.next(), Some(1));
|
||||
assert_eq!(iter.next(), Some(2));
|
||||
assert_eq!(iter.next(), Some(3));
|
||||
assert_eq!(iter.next(), None);
|
||||
}
|
Loading…
Reference in New Issue
Block a user