Skip to content

Commit

Permalink
Sort members of codex::ROOT (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyyyylime authored Nov 26, 2024
1 parent 6c0480a commit 7106152
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ pub enum Symbol {

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

include!(concat!(env!("OUT_DIR"), "/out.rs"));

#[cfg(test)]
mod test {
use super::*;

#[test]
fn all_modules_sorted() {
fn assert_sorted_recursively(root: Module) {
assert!(root.0.is_sorted_by_key(|(k, _)| k));

for (_, def) in root.iter() {
if let Def::Module(module) = def {
assert_sorted_recursively(module)
}
}
}

assert_sorted_recursively(ROOT);
}
}

0 comments on commit 7106152

Please sign in to comment.