Skip to main content

rustolio_utils/
concat_classes.rs

1//
2// SPDX-License-Identifier: MPL-2.0
3//
4// Copyright (c) 2026 Tobias Binnewies. All rights reserved.
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at http://mozilla.org/MPL/2.0/.
9//
10
11/// `concat!` wrapper with whitespace delimiter
12#[macro_export]
13macro_rules! concat_classes {
14    ($($e:expr),* $(,)?) => {
15        concat!( $($e, " "),* )
16    };
17}
18
19#[cfg(test)]
20mod tests {
21    #[test]
22    fn test_concat_classes() {
23        let expected = "";
24        let actual = concat_classes!();
25        assert_eq!(actual, expected);
26
27        let expected = "abc ";
28        let actual = concat_classes!("abc");
29        assert_eq!(actual, expected);
30
31        let expected = "abc def 123 12.34 ";
32        let actual = concat_classes!("abc", "def", 123, 12.34);
33        assert_eq!(actual, expected);
34    }
35}