proxmox/proxmox-sortable-macro/tests/test.rs
Wolfgang Bumiller be7b330d8f sortable-macro: remove need for 'identity' macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-26 14:10:14 +01:00

21 lines
516 B
Rust

use proxmox_sortable_macro::sortable;
// In a normal project we would use this Cargo.toml line:
//
// [dependencies]
// proxmox = { version = "0.1", features = [ "sortable-macro" ] }
//
// Then:
// use proxmox::{sortable, identity};
#[test]
fn test_id() {
#[sortable]
const FOO: [&str; 3] = sorted!(["3", "2", "1"]);
assert_eq!(FOO, ["1", "2", "3"]);
#[sortable]
const FOO2: [(&str, usize); 3] = sorted!([("3", 1), ("2", 2), ("1", 3)]);
assert_eq!(FOO2, [("1", 3), ("2", 2), ("3", 1)]);
}