tests.rs

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