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 git_tests;
17mod integration_tests;
18mod notification_tests;
19mod random_channel_buffer_tests;
20mod random_project_collaboration_tests;
21mod randomized_test_helpers;
22mod remote_editing_collaboration_tests;
23mod test_server;
24
25use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher};
26pub use randomized_test_helpers::{
27 run_randomized_test, save_randomized_test_plan, RandomizedTest, TestError, UserTestPlan,
28};
29pub use test_server::{TestClient, TestServer};
30
31#[derive(Debug, Eq, PartialEq)]
32struct RoomParticipants {
33 remote: Vec<String>,
34 pending: Vec<String>,
35}
36
37fn room_participants(room: &Entity<Room>, cx: &mut TestAppContext) -> RoomParticipants {
38 room.read_with(cx, |room, _| {
39 let mut remote = room
40 .remote_participants()
41 .iter()
42 .map(|(_, participant)| participant.user.github_login.clone())
43 .collect::<Vec<_>>();
44 let mut pending = room
45 .pending_participants()
46 .iter()
47 .map(|user| user.github_login.clone())
48 .collect::<Vec<_>>();
49 remote.sort();
50 pending.sort();
51 RoomParticipants { remote, pending }
52 })
53}
54
55fn channel_id(room: &Entity<Room>, cx: &mut TestAppContext) -> Option<ChannelId> {
56 cx.read(|cx| room.read(cx).channel_id())
57}
58
59fn rust_lang() -> Arc<Language> {
60 Arc::new(Language::new(
61 LanguageConfig {
62 name: "Rust".into(),
63 matcher: LanguageMatcher {
64 path_suffixes: vec!["rs".to_string()],
65 ..Default::default()
66 },
67 ..Default::default()
68 },
69 Some(tree_sitter_rust::LANGUAGE.into()),
70 ))
71}