chrome_for_testing/api/
channel.rs

1use serde::Deserialize;
2use std::fmt::{Debug, Display};
3
4/// Chrome release channel.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize)]
6pub enum Channel {
7    /// The stable release channel - the default Chrome version for general users.
8    Stable,
9
10    /// The beta release channel - preview of upcoming stable features.
11    /// Less stable than stable, used for testing new functionality before it reaches stable.
12    Beta,
13
14    /// The dev release channel - early development builds with cutting-edge features.
15    /// Less stable than beta, intended for developers and early adopters.
16    Dev,
17
18    /// The canary release channel - nightly builds with the absolute latest changes.
19    /// Less stable than dev, highly experimental.
20    Canary,
21}
22
23impl Display for Channel {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        // Use the Debug implementation.
26        write!(f, "{self:?}")
27    }
28}
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33    use assertr::prelude::*;
34
35    #[test]
36    fn display_impl_formats_channels_as_expected() {
37        assert_that(format!("{}", Channel::Stable)).is_equal_to("Stable");
38        assert_that(format!("{}", Channel::Beta)).is_equal_to("Beta");
39        assert_that(format!("{}", Channel::Dev)).is_equal_to("Dev");
40        assert_that(format!("{}", Channel::Canary)).is_equal_to("Canary");
41    }
42}