@@ -396,6 +396,9 @@ mod tests {
396396 use crate :: write:: Format ;
397397 use std:: io:: Cursor ;
398398
399+ const FASTQ_R1_PATH : & str = "./data/subset_R1.fastq.gz" ;
400+ const FASTQ_R2_PATH : & str = "./data/subset_R2.fastq.gz" ;
401+
399402 #[ test]
400403 fn test_encoder_builder_construction ( ) {
401404 let builder = BinseqWriterBuilder :: new ( Format :: Vbq ) ;
@@ -427,18 +430,33 @@ mod tests {
427430 assert ! ( matches!( encoder_builder. input, Some ( FastxInput :: Stdin ) ) ) ;
428431 }
429432
433+ #[ test]
434+ fn test_encoder_builder_single ( ) {
435+ let builder = BinseqWriterBuilder :: new ( Format :: Vbq ) ;
436+ let handle = Box :: new ( Cursor :: new ( Vec :: new ( ) ) ) ;
437+ let encoder_builder = FastxEncoderBuilder :: new ( builder, handle) . input ( FASTQ_R1_PATH ) ;
438+
439+ assert ! ( matches!( encoder_builder. input, Some ( FastxInput :: Single ( _) ) ) ) ;
440+
441+ // Run the encoder builder and assert that it is successful
442+ assert ! ( encoder_builder. run( ) . is_ok( ) ) ;
443+ }
444+
430445 #[ test]
431446 fn test_encoder_builder_paired ( ) {
432447 let builder = BinseqWriterBuilder :: new ( Format :: Vbq ) ;
433448 let handle = Box :: new ( Cursor :: new ( Vec :: new ( ) ) ) ;
434449 let encoder_builder =
435- FastxEncoderBuilder :: new ( builder, handle) . input_paired ( "r1.fastq" , "r2.fastq" ) ;
450+ FastxEncoderBuilder :: new ( builder, handle) . input_paired ( FASTQ_R1_PATH , FASTQ_R2_PATH ) ;
436451
437452 assert ! ( matches!(
438453 encoder_builder. input,
439454 Some ( FastxInput :: Paired ( _, _) )
440455 ) ) ;
441456 // Should automatically set paired mode
442457 assert ! ( encoder_builder. builder. paired) ;
458+
459+ // Run the encoder builder and assert that it is successful
460+ assert ! ( encoder_builder. run( ) . is_ok( ) ) ;
443461 }
444462}
0 commit comments