diff --git a/client/src/main.rs b/client/src/main.rs index ff586f1..e968053 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -9,12 +9,17 @@ use env_logger; use solstice_proto; mod client; +#[cfg(test)] mod context; mod control; +#[cfg(test)] mod dispatcher; +#[cfg(test)] mod executor; +#[cfg(test)] mod handlers; mod login; +#[cfg(test)] mod message_handler; mod room; mod user; diff --git a/client/src/room.rs b/client/src/room.rs index 61575e1..b291e74 100644 --- a/client/src/room.rs +++ b/client/src/room.rs @@ -134,6 +134,7 @@ impl RoomMap { /// Looks up the given room name in the map, returning an immutable /// reference to the associated data if found, or an error if not found. + #[cfg(test)] fn get_strict(&self, room_name: &str) -> Result<&Room, Error> { match self.map.get(room_name) { Some(room) => Ok(room), diff --git a/client/src/user.rs b/client/src/user.rs index a6b454e..c45270a 100644 --- a/client/src/user.rs +++ b/client/src/user.rs @@ -44,6 +44,7 @@ impl UserMap { /// Looks up the given user name in the map, returning an immutable /// reference to the associated data if found. + #[cfg(test)] pub fn get(&self, user_name: &str) -> Option<&User> { self.map.get(user_name) } @@ -97,6 +98,7 @@ impl UserMap { } /// Returns a copy of the set of privileged users. + #[cfg(test)] pub fn get_all_privileged(&self) -> Vec { self.privileged.iter().map(|s| s.to_string()).collect() } @@ -112,6 +114,7 @@ impl UserMap { } /// Checks if the given user is privileged. + #[cfg(test)] pub fn is_privileged(&self, user_name: &str) -> bool { self.privileged.contains(user_name) }