Skip to content

Commit dcf9f61

Browse files
committed
Add tests
Closes #2773 Closes #2786
1 parent 4fa2969 commit dcf9f61

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

tests/source/chains.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,34 @@ fn issue2415() {
228228
})()
229229
.unwrap_or_else(|_: Box<::std::error::Error>| String::from(""));
230230
}
231+
232+
impl issue_2786 {
233+
fn thing(&self) {
234+
foo(|a| {
235+
println!("a");
236+
println!("b");
237+
}).bar(|c| {
238+
println!("a");
239+
println!("b");
240+
})
241+
.baz(|c| {
242+
println!("a");
243+
println!("b");
244+
})
245+
}
246+
}
247+
248+
fn issue_2773() {
249+
let bar = Some(0);
250+
bar.or_else(|| {
251+
// do stuff
252+
None
253+
}).or_else(|| {
254+
// do other stuff
255+
None
256+
})
257+
.and_then(|val| {
258+
// do this stuff
259+
None
260+
});
261+
}

tests/target/chains.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,32 @@ fn issue2415() {
250250
})().ok_or("")?)
251251
})().unwrap_or_else(|_: Box<::std::error::Error>| String::from(""));
252252
}
253+
254+
impl issue_2786 {
255+
fn thing(&self) {
256+
foo(|a| {
257+
println!("a");
258+
println!("b");
259+
}).bar(|c| {
260+
println!("a");
261+
println!("b");
262+
}).baz(|c| {
263+
println!("a");
264+
println!("b");
265+
})
266+
}
267+
}
268+
269+
fn issue_2773() {
270+
let bar = Some(0);
271+
bar.or_else(|| {
272+
// do stuff
273+
None
274+
}).or_else(|| {
275+
// do other stuff
276+
None
277+
}).and_then(|val| {
278+
// do this stuff
279+
None
280+
});
281+
}

0 commit comments

Comments
 (0)