2019-07-26 21:54:25 +00:00
|
|
|
//@ run-pass
|
2012-06-30 01:09:56 +00:00
|
|
|
// Tests for the new |args| expr lambda syntax
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn f<F>(i: isize, f: F) -> isize where F: FnOnce(isize) -> isize { f(i) }
|
2012-06-30 01:09:56 +00:00
|
|
|
|
2015-01-02 22:32:54 +00:00
|
|
|
fn g<G>(_g: G) where G: FnOnce() { }
|
2012-06-30 01:09:56 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(f(10, |a| a), 10);
|
2012-06-30 01:09:56 +00:00
|
|
|
g(||());
|
2013-11-22 01:23:21 +00:00
|
|
|
assert_eq!(f(10, |a| a), 10);
|
|
|
|
g(||{});
|
2012-06-30 01:09:56 +00:00
|
|
|
}
|