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