返回 CodeWhale
lib.rs
1 //! Normal compilation of the actual complete session group without a host.
2 pub mod commands;
3
4 #[cfg(test)]
5 mod tests {
6 use super::commands::groups::session::portable_handlers;
7 use codewhale_command_contract::handler::{CommandContexts, CommandHandler};
8
9 #[test]
10 fn whole_inventory_keeps_order_and_rejects_missing_authority() {
11 let handlers = portable_handlers();
12 assert_eq!(
13 handlers.map(|(info, _)| info.name),
14 [
15 "rename",
16 "title",
17 "color",
18 "save",
19 "fork",
20 "new",
21 "sessions",
22 "load",
23 "resume",
24 "tree",
25 "branch",
26 "compact",
27 "purge",
28 "relay",
29 "rc",
30 "remote-env",
31 "export",
32 "structcopy",
33 ]
34 );
35 for (info, handler) in portable_handlers() {
36 if let CommandHandler::Contextual { handler, .. } = handler {
37 let result = handler(CommandContexts::empty(), None);
38 assert!(result.is_error, "{} accepted missing authority", info.name);
39 assert!(
40 result.action.is_none(),
41 "{} emitted action without authority",
42 info.name
43 );
44 }
45 }
46 }
47 }
48
48 lines RUST