Skip to content

Commit

Permalink
Add dummy implementation with test for manjaro kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
rnestler committed Feb 8, 2024
1 parent 7e07052 commit ac3a1f0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ impl KernelInfo {
let variant = last_part.to_string();
let version = uname_output[0..last_dash].replace('-', ".");

if variant == "MANJARO" {
return Ok(Self::get_manjaro_kernel_info(version));
}

Ok(KernelInfo {
version,
package_name: format!("linux-{variant}"),
Expand All @@ -77,6 +81,14 @@ impl KernelInfo {
})
}
}

fn get_manjaro_kernel_info(version: String) -> KernelInfo {
KernelInfo {
version,
variant: Some("MANJARO".to_string()),
package_name: "TODO".to_string()
}
}
}

pub struct KernelChecker {
Expand Down Expand Up @@ -176,6 +188,18 @@ mod test {
);
}

#[test]
fn test_kernel_verion_from_uname_output_manjaro() {
let kernel_version = KernelInfo::from_uname_output("6.1.71-1-MANJARO").unwrap();
assert_eq!(
KernelInfo {
version: "6.1.71.1".to_owned(),
variant: Some("MANJARO".to_owned()),
package_name: "linux61".to_owned()
},
kernel_version)
}

#[test]
fn test_kernel_version_from_uname_output_ck_generic_v3() {
let kernel_version = KernelInfo::from_uname_output("6.4.1-2-ck-generic-v3").unwrap();
Expand Down

0 comments on commit ac3a1f0

Please sign in to comment.