Skip to content

Commit

Permalink
Run unit tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
demurgos committed Apr 16, 2024
1 parent 924e1b1 commit e7b9230
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: "--all-targets --all-features -- -D warnings"

- name: Run tests
run: "cargo test"
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ impl DesktopEnvironment {
/// ```
/// use detect_desktop_environment::DesktopEnvironment;
///
/// assert_eq!("KDE", Some(DesktopEnvironment::Kde));
/// assert_eq!("kde", None); // must be uppercase
/// assert_eq!("SWAY", None); // not registered
/// assert_eq!("unknown_de", None);
/// assert_eq!(Some(DesktopEnvironment::Kde), DesktopEnvironment::from_freedesktop("KDE"));
/// assert_eq!(None, DesktopEnvironment::from_freedesktop("kde")); // must be uppercase
/// assert_eq!(None, DesktopEnvironment::from_freedesktop("SWAY")); // not registered
/// assert_eq!(None, DesktopEnvironment::from_freedesktop("unknown_de"));
/// ```
pub fn from_freedesktop(name: &str) -> Option<Self> {
// the patterns in the match below are ordered to match the order in the freedesktop table
Expand Down Expand Up @@ -239,10 +239,10 @@ impl DesktopEnvironment {
/// ```
/// use detect_desktop_environment::DesktopEnvironment;
///
/// assert_eq!("KDE", Some(DesktopEnvironment::Kde)); // freedesktop DE
/// assert_eq!("kde", None); // must be uppercase
/// assert_eq!("SWAY", Some(DesktopEnvironment::Sway)); // not registered
/// assert_eq!("unknown_de", None);
/// assert_eq!(Some(DesktopEnvironment::Kde), DesktopEnvironment::from_xdg_name("KDE")); // freedesktop DE
/// assert_eq!(None, DesktopEnvironment::from_xdg_name("kde")); // must be uppercase
/// assert_eq!(Some(DesktopEnvironment::Sway), DesktopEnvironment::from_xdg_name("SWAY")); // not registered
/// assert_eq!(None, DesktopEnvironment::from_xdg_name("unknown_de"));
/// ```
pub fn from_xdg_name(name: &str) -> Option<Self> {
if let Some(de) = Self::from_freedesktop(name) {
Expand Down

0 comments on commit e7b9230

Please sign in to comment.