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