1// todo(windows): Actually run the tests
2#![cfg(not(target_os = "windows"))]
3
4use std::sync::Arc;
5
6use call::Room;
7use client::ChannelId;
8use gpui::{Entity, TestAppContext};
9
10mod channel_buffer_tests;
11mod channel_guest_tests;
12mod channel_message_tests;
13mod channel_tests;
14mod editor_tests;
15mod following_tests;
16mod integration_tests;
17mod notification_tests;
18mod random_channel_buffer_tests;
19mod random_project_collaboration_tests;
20mod randomized_test_helpers;
21mod remote_editing_collaboration_tests;
22mod test_server;
23
24use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher};
25pub use randomized_test_helpers::{
26 run_randomized_test, save_randomized_test_plan, RandomizedTest, TestError, UserTestPlan,
27};
28pub use test_server::{TestClient, TestServer};
29
30#[derive(Debug, Eq, PartialEq)]
31struct RoomParticipants {
32 remote: Vec<String>,
33 pending: Vec<String>,
34}
35
36fn room_participants(room: &Entity<Room>, cx: &mut TestAppContext) -> RoomParticipants {
37 room.read_with(cx, |room, _| {
38 let mut remote = room
39 .remote_participants()
40 .iter()
41 .map(|(_, participant)| participant.user.github_login.clone())
42 .collect::<Vec<_>>();
43 let mut pending = room
44 .pending_participants()
45 .iter()
46 .map(|user| user.github_login.clone())
47 .collect::<Vec<_>>();
48 remote.sort();
49 pending.sort();
50 RoomParticipants { remote, pending }
51 })
52}
53
54fn channel_id(room: &Entity<Room>, cx: &mut TestAppContext) -> Option<ChannelId> {
55 cx.read(|cx| room.read(cx).channel_id())
56}
57
58fn rust_lang() -> Arc<Language> {
59 Arc::new(Language::new(
60 LanguageConfig {
61 name: "Rust".into(),
62 matcher: LanguageMatcher {
63 path_suffixes: vec!["rs".to_string()],
64 ..Default::default()
65 },
66 ..Default::default()
67 },
68 Some(tree_sitter_rust::LANGUAGE.into()),
69 ))
70}