Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run unit tests in CI #10

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![GitHub](https://img.shields.io/badge/GitHub-demurgos%2Fdetect--desktop--environment-informational.svg?maxAge=86400)](https://github.com/demurgos/detect-desktop-environment)
[![crates.io](https://img.shields.io/crates/v/detect-desktop-environment.svg?maxAge=86400)](https://crates.io/crates/detect-desktop-environment)
[![CI status](https://img.shields.io/github/actions/workflow/status/demurgos/detect-desktop-environment/check-rs.yml.svg?branch=main&maxAge=86400)](https://github.com/demurgos/detect-desktop-environment/actions/workflows/check-rs.yml)
[![CI status](https://img.shields.io/github/actions/workflow/status/demurgos/detect-desktop-environment/check-rs.yml.svg?branch=main&maxAge=86400)](https://github.com/demurgos/detect-desktop-environment/actions/workflows/check-rs.yml?query=branch%3Amain)
[![docs.rs/detect-desktop-environment](https://img.shields.io/docsrs/detect-desktop-environment.svg?maxAge=86400)](https://docs.rs/detect-desktop-environment)
[![license MIT](https://img.shields.io/badge/license-MIT-green)](./LICENSE.md)

Expand Down
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
Loading