Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebedthan committed May 24, 2021
1 parent e4e7521 commit 62af5f9
Showing 1 changed file with 37 additions and 18 deletions.
55 changes: 37 additions & 18 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ mod tests {
let forward = tempfile::tempfile().expect("Cannot create temp file");
let reverse = tempfile::tempfile().expect("Cannot create temp file");
let unknown = tempfile::tempfile().expect("Cannot create temp file");

bc_data.insert(b"ACCGTA", vec![forward]);
bc_data.insert(b"ATTGTT", vec![reverse]);
bc_data.insert(b"XXX", vec![unknown]);
Expand Down Expand Up @@ -851,8 +851,10 @@ mod tests {

assert!((write_to_fa(&file, cmp, &record, niffler::Level::One)).is_ok());

let mut tmpfile = tempfile::NamedTempFile::new().expect("Cannot create temp file");
writeln!(tmpfile, ">id_str desc\nATCGCCG").expect("Cannot write to tmp file");
let mut tmpfile =
tempfile::NamedTempFile::new().expect("Cannot create temp file");
writeln!(tmpfile, ">id_str desc\nATCGCCG")
.expect("Cannot write to tmp file");

let mut fa_records = fasta::Reader::from_file(tmpfile)
.expect("Cannot read file.")
Expand All @@ -879,8 +881,10 @@ mod tests {

assert!((write_to_fq(&file, cmp, &record, niffler::Level::One)).is_ok());

let mut tmpfile = tempfile::NamedTempFile::new().expect("Cannot create temp file");
writeln!(tmpfile, ">id_str desc\nATCGCCG\n+\nQQQQQQQ").expect("Cannot write to tmp file");
let mut tmpfile =
tempfile::NamedTempFile::new().expect("Cannot create temp file");
writeln!(tmpfile, ">id_str desc\nATCGCCG\n+\nQQQQQQQ")
.expect("Cannot write to tmp file");

let mut fa_records = fastq::Reader::from_file(tmpfile)
.expect("Cannot read file.")
Expand Down Expand Up @@ -935,7 +939,6 @@ mod tests {

#[test]
fn test_to_niffler_level() {

assert_eq!(to_niffler_level(1), niffler::Level::One);
assert_eq!(to_niffler_level(2), niffler::Level::Two);
assert_eq!(to_niffler_level(3), niffler::Level::Three);
Expand All @@ -945,26 +948,42 @@ mod tests {
assert_eq!(to_niffler_level(7), niffler::Level::Seven);
assert_eq!(to_niffler_level(8), niffler::Level::Eight);
assert_eq!(to_niffler_level(9), niffler::Level::Nine);

}

#[test]
fn test_to_niffler_format() {

assert_eq!(to_niffler_format("gz").unwrap(), niffler::compression::Format::Gzip);
assert_eq!(to_niffler_format("xz").unwrap(), niffler::compression::Format::Lzma);
assert_eq!(to_niffler_format("bz2").unwrap(), niffler::compression::Format::Bzip);
assert_eq!(to_niffler_format("txt").unwrap(), niffler::compression::Format::No);

assert_eq!(
to_niffler_format("gz").unwrap(),
niffler::compression::Format::Gzip
);
assert_eq!(
to_niffler_format("xz").unwrap(),
niffler::compression::Format::Lzma
);
assert_eq!(
to_niffler_format("bz2").unwrap(),
niffler::compression::Format::Bzip
);
assert_eq!(
to_niffler_format("txt").unwrap(),
niffler::compression::Format::No
);
}

#[test]
fn test_to_compression_ext() {

assert_eq!(to_compression_ext(niffler::compression::Format::Gzip), *".gz");
assert_eq!(to_compression_ext(niffler::compression::Format::Lzma), *".xz");
assert_eq!(to_compression_ext(niffler::compression::Format::Bzip), *".bz2");
assert_eq!(
to_compression_ext(niffler::compression::Format::Gzip),
*".gz"
);
assert_eq!(
to_compression_ext(niffler::compression::Format::Lzma),
*".xz"
);
assert_eq!(
to_compression_ext(niffler::compression::Format::Bzip),
*".bz2"
);
assert_eq!(to_compression_ext(niffler::compression::Format::No), *"");

}
}

0 comments on commit 62af5f9

Please sign in to comment.