module.rs 612 B

1234567891011121314151617181920212223
  1. use crate::helper::*;
  2. use flowy_sys::prelude::*;
  3. pub async fn hello() -> String { "say hello".to_string() }
  4. #[test]
  5. fn test_init() {
  6. setup_env();
  7. let event = "1";
  8. let modules = vec![Module::new().event(event, hello)];
  9. init_system(modules, move || {
  10. let request = EventRequest::new(event);
  11. let stream_data = CommandData::new(1, Some(request)).with_callback(Box::new(|_config, response| {
  12. log::info!("async resp: {:?}", response);
  13. }));
  14. let resp = sync_send(stream_data);
  15. log::info!("sync resp: {:?}", resp);
  16. stop_system();
  17. });
  18. }