2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
|
|
|
|
2013-10-06 04:15:46 +00:00
|
|
|
pub fn main() {
|
2014-05-25 10:17:19 +00: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-06 04:15:46 +00:00
|
|
|
|
|
|
|
assert_eq!(
|
2015-03-03 08:42:26 +00:00
|
|
|
concat!(1, 2, 3, 4f32, 4.0, 'a', true),
|
2013-10-06 04:15:46 +00:00
|
|
|
"12344.0atrue"
|
|
|
|
);
|
2014-08-30 22:45:11 +00:00
|
|
|
|
|
|
|
assert!(match "12344.0atrue" {
|
2015-03-03 08:42:26 +00:00
|
|
|
concat!(1, 2, 3, 4f32, 4.0, 'a', true) => true,
|
2014-08-30 22:45:11 +00:00
|
|
|
_ => false
|
|
|
|
})
|
2013-10-06 04:15:46 +00:00
|
|
|
}
|