diff --git a/src/seqtk/seqtk_subseq/test.sh b/src/seqtk/seqtk_subseq/test.sh index 4f73e1e8..f19cfa4a 100644 --- a/src/seqtk/seqtk_subseq/test.sh +++ b/src/seqtk/seqtk_subseq/test.sh @@ -13,7 +13,7 @@ echo "Creating Test Data..." mkdir test_data # Create and populate input.fasta -cat < "test_data/input.fasta" +cat > "test_data/input.fasta" <KU562861.1 GGAGCAGGAGAGTGTTCGAGTTCAGAGATGTCCATGGCGCCGTACGAGAAGGTGATGGATGACCTGGCCA AGGGGCAGCAGTTCGCGACGCAGCTGCAGGGCCTCCTCCGGGACTCCCCCAAGGCCGGCCACATCATGGA @@ -32,13 +32,13 @@ AAAAGCAATCCCAATAGTGGTTACATCCAAACAAAACCCATTTCTTATATTTTCTCAAAAACAGTGAGAG EOL # Update id.list with new entries -cat < "test_data/id.list" +cat > "test_data/id.list" < "test_data/reg.bed" +cat > "test_data/reg.bed" < Run seqtk_subseq with TAB option" expected_output_tabular=$'KU562861.1\t11\tAGTGTTCGAG\nMH150936.1\t11\tTGAAAACTTT' output_tabular=$(cat sub_sample.fq) -if [ "$output_tabular" == "$expected_output_tabular" ]; then - echo "Test passed" -else +if [ "$output_tabular" != "$expected_output_tabular" ]; then echo "Test failed" echo "Expected:" echo "$expected_output_tabular" echo "Got:" echo "$output_tabular" + exit 1 fi ######################################################################################### @@ -145,14 +142,13 @@ TGAAA ACTTT" output_wrapped=$(cat sub_sample.fq) -if [ "$output_wrapped" == "$expected_output_wrapped" ]; then - echo "Test passed" -else +if [ "$output_wrapped" != "$expected_output_wrapped" ]; then echo "Test failed" echo "Expected:" echo "$expected_output_wrapped" echo "Got:" echo "$output_wrapped" + exit 1 fi ######################################################################################### @@ -174,12 +170,13 @@ AGTGTTCGAG AAAGTTTTCA" output_wrapped=$(cat sub_sample.fq) -if [ "$output_wrapped" == "$expected_output_wrapped" ]; then - echo "Test passed" -else +if [ "$output_wrapped" != "$expected_output_wrapped" ]; then echo "Test failed" echo "Expected:" echo "$expected_output_wrapped" echo "Got:" echo "$output_wrapped" + exit 1 fi + +echo "All tests succeeded!"