From 3ba26d561a12fb93c2d028b623f647c65389e97c Mon Sep 17 00:00:00 2001 From: zietzm Date: Mon, 22 Jul 2024 14:13:33 -0500 Subject: [PATCH] feat: add test for prefix as phenotype name --- src/util.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/util.rs b/src/util.rs index c3f764f..5ab1275 100644 --- a/src/util.rs +++ b/src/util.rs @@ -294,3 +294,25 @@ pub fn run( Ok(()) } + +mod tests { + #[test] + fn test_gwas_path_to_phenotype() { + let paths = [ + "plink.glm", + "plink.glm.linear", + "plink.glm.linear.zst", + "plink.glm.linear.gz", + "plink.glm.linear.zst.gz", + ]; + for path in paths.iter() { + let result = crate::util::gwas_path_to_phenotype(path); + assert_eq!(result, "plink"); + } + + assert_eq!( + crate::util::gwas_path_to_phenotype("feature1.tsv"), + "feature1" + ); + } +}