返回 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 "save",
18 "fork",
19 "new",
20 "sessions",
21 "load",
22 "resume",
23 "tree",
24 "branch",
25 "compact",
26 "purge",
27 "relay",
28 "rc",
29 "remote-env",
30 "export",
31 "structcopy",
32 ]
33 );
34 for (info, handler) in portable_handlers() {
35 if let CommandHandler::Contextual { handler, .. } = handler {
36 let result = handler(CommandContexts::empty(), None);
37 assert!(result.is_error, "{} accepted missing authority", info.name);
38 assert!(
39 result.action.is_none(),
40 "{} emitted action without authority",
41 info.name
42 );
43 }
44 }
45 }
46 }
47
47 lines RUST