Skip to content

Commit 7106152

Browse files
authored
Sort members of codex::ROOT (#8)
1 parent 6c0480a commit 7106152

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ pub enum Symbol {
4141

4242
/// A module that contains the other top-level modules.
4343
pub const ROOT: Module =
44-
Module(&[("sym", Def::Module(SYM)), ("emoji", Def::Module(EMOJI))]);
44+
Module(&[("emoji", Def::Module(EMOJI)), ("sym", Def::Module(SYM))]);
4545

4646
include!(concat!(env!("OUT_DIR"), "/out.rs"));
47+
48+
#[cfg(test)]
49+
mod test {
50+
use super::*;
51+
52+
#[test]
53+
fn all_modules_sorted() {
54+
fn assert_sorted_recursively(root: Module) {
55+
assert!(root.0.is_sorted_by_key(|(k, _)| k));
56+
57+
for (_, def) in root.iter() {
58+
if let Def::Module(module) = def {
59+
assert_sorted_recursively(module)
60+
}
61+
}
62+
}
63+
64+
assert_sorted_recursively(ROOT);
65+
}
66+
}

0 commit comments

Comments
 (0)