From 95f202f2120fed4e9f8a5f99104475a05d3c9def Mon Sep 17 00:00:00 2001 From: Vladimir Mikryukov Date: Sun, 27 Oct 2024 17:29:33 +0200 Subject: [PATCH] bash tests - replace echo with printf (newline problems) --- test/test2_binary.sh | 55 ++++++-------------------------------------- 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/test/test2_binary.sh b/test/test2_binary.sh index aa4b512..bc8aa6f 100644 --- a/test/test2_binary.sh +++ b/test/test2_binary.sh @@ -9,15 +9,7 @@ total_tests=0 # Test basic usage function test_basic_usage { result=$(../seqhasher test2.fasta -) - expected=$(cat <test2.fasta;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq1 -AAAA ->test2.fasta;f74673f038f3657adfa522aa370b5cd161dec321;seq2 -ACTG ->test2.fasta;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq3 -AAAA -EOF -) + expected=$(printf ">test2.fasta;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq1\nAAAA\n>test2.fasta;65c89f59d38cdbf90dfaf0b0a6884829df8396b0;seq2\nACTG\n>test2.fasta;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq3\nAAAA\n") ((total_tests++)) if [[ "$result" != "$expected" ]]; then echo -e "\e[31m'Basic usage' test failed\e[0m" @@ -30,15 +22,7 @@ EOF # Test custom name function test_custom_name { result=$(../seqhasher --name "custom_name" test2.fasta -) - expected=$(cat <custom_name;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq1 -AAAA ->custom_name;65c89f59d38cdbf90dfaf0b0a6884829df8396b0;seq2 -ACTG ->custom_name;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq3 -AAAA -EOF -) + expected=$(printf ">custom_name;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq1\nAAAA\n>custom_name;65c89f59d38cdbf90dfaf0b0a6884829df8396b0;seq2\nACTG\n>custom_name;e2512172abf8cc9f67fdd49eb6cacf2df71bbad3;seq3\nAAAA\n") ((total_tests++)) if [[ "$result" != "$expected" ]]; then echo -e "\e[31m'Custom name' test failed\e[0m" @@ -51,12 +35,7 @@ EOF # Test headers only function test_headers_only { result=$(../seqhasher --headersonly test2.fasta -) - expected=$(cat <