action_macros.rs

 1use gpui::{Action, actions};
 2use gpui_macros::register_action;
 3use schemars::JsonSchema;
 4use serde_derive::Deserialize;
 5
 6#[test]
 7fn test_action_macros() {
 8    actions!(
 9        test_only,
10        [
11            SomeAction,
12            /// Documented action
13            SomeActionWithDocs,
14        ]
15    );
16
17    #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
18    #[action(namespace = test_only)]
19    struct AnotherSomeAction;
20
21    #[derive(PartialEq, Clone, gpui::private::serde_derive::Deserialize)]
22    struct RegisterableAction {}
23
24    register_action!(RegisterableAction);
25
26    impl gpui::Action for RegisterableAction {
27        fn boxed_clone(&self) -> Box<dyn gpui::Action> {
28            unimplemented!()
29        }
30
31        fn partial_eq(&self, _action: &dyn gpui::Action) -> bool {
32            unimplemented!()
33        }
34
35        fn name(&self) -> &'static str {
36            unimplemented!()
37        }
38
39        fn name_for_type() -> &'static str
40        where
41            Self: Sized,
42        {
43            unimplemented!()
44        }
45
46        fn build(_value: serde_json::Value) -> anyhow::Result<Box<dyn gpui::Action>>
47        where
48            Self: Sized,
49        {
50            unimplemented!()
51        }
52    }
53}