2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
|
|
|
|
2013-10-05 21:15:46 -07:00
|
|
|
pub fn main() {
|
2014-05-25 03:17:19 -07:00
|
|
|
assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string());
|
|
|
|
assert_eq!(format!(concat!()), "".to_string());
|
2014-06-23 15:51:40 +00:00
|
|
|
// check trailing comma is allowed in concat
|
|
|
|
assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string());
|
2013-10-05 21:15:46 -07:00
|
|
|
|
|
|
|
assert_eq!(
|
2015-03-03 10:42:26 +02:00
|
|
|
concat!(1, 2, 3, 4f32, 4.0, 'a', true),
|
2013-10-05 21:15:46 -07:00
|
|
|
"12344.0atrue"
|
|
|
|
);
|
2014-08-31 01:45:11 +03:00
|
|
|
|
|
|
|
assert!(match "12344.0atrue" {
|
2015-03-03 10:42:26 +02:00
|
|
|
concat!(1, 2, 3, 4f32, 4.0, 'a', true) => true,
|
2014-08-31 01:45:11 +03:00
|
|
|
_ => false
|
|
|
|
})
|
2013-10-05 21:15:46 -07:00
|
|
|
}
|