Skip to content

Commit dd691b3

Browse files
committed
feature/tests: Use const interval
1 parent b43e6c8 commit dd691b3

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

src/feature.rs

+17-24
Original file line numberDiff line numberDiff line change
@@ -52,47 +52,40 @@ impl Feature {
5252
mod tests {
5353
use super::*;
5454

55-
fn build_feature() -> Result<Feature, noodles::core::position::TryFromIntError> {
56-
Ok(Feature::new(
57-
0,
58-
Position::try_from(8)?,
59-
Position::try_from(13)?,
60-
gff::feature::record::Strand::Forward,
61-
))
55+
const START: Position = Position::new(8).unwrap();
56+
const END: Position = Position::new(13).unwrap();
57+
58+
fn build_feature() -> Feature {
59+
Feature::new(0, START, END, gff::feature::record::Strand::Forward)
6260
}
6361

6462
#[test]
65-
fn test_reference_sequence_id() -> Result<(), noodles::core::position::TryFromIntError> {
66-
let feature = build_feature()?;
63+
fn test_reference_sequence_id() {
64+
let feature = build_feature();
6765
assert_eq!(feature.reference_sequence_id(), 0);
68-
Ok(())
6966
}
7067

7168
#[test]
72-
fn test_start() -> Result<(), noodles::core::position::TryFromIntError> {
73-
let feature = build_feature()?;
74-
assert_eq!(feature.start(), Position::try_from(8)?);
75-
Ok(())
69+
fn test_start() {
70+
let feature = build_feature();
71+
assert_eq!(feature.start(), START);
7672
}
7773

7874
#[test]
79-
fn test_end() -> Result<(), noodles::core::position::TryFromIntError> {
80-
let feature = build_feature()?;
81-
assert_eq!(feature.end(), Position::try_from(13)?);
82-
Ok(())
75+
fn test_end() {
76+
let feature = build_feature();
77+
assert_eq!(feature.end(), END);
8378
}
8479

8580
#[test]
86-
fn test_strand() -> Result<(), noodles::core::position::TryFromIntError> {
87-
let feature = build_feature()?;
81+
fn test_strand() {
82+
let feature = build_feature();
8883
assert_eq!(feature.strand(), gff::feature::record::Strand::Forward);
89-
Ok(())
9084
}
9185

9286
#[test]
93-
fn test_length() -> Result<(), noodles::core::position::TryFromIntError> {
94-
let feature = build_feature()?;
87+
fn test_length() {
88+
let feature = build_feature();
9589
assert_eq!(feature.length(), 6);
96-
Ok(())
9790
}
9891
}

0 commit comments

Comments
 (0)