Browse Source

[enh] unit tests on cotes:
- remove " and ` from all ASCII char because there is a parsing error.
- seperate cote type from spaces tests:
- remove spaces from simple tests.
- add new tests which check spaces between cotes blocks are kept.

Moul 4 years ago
parent
commit
4d641f6e7b
1 changed files with 18 additions and 13 deletions
  1. 18 13
      tests.sh

+ 18 - 13
tests.sh

@@ -120,18 +120,25 @@ tests=(
 ## cotes parsing
 "echo 'test'" # simple cotes
 "echo \"test\"" # double cotes
-"echo '   simple    ' \"   double  \"" # Mix simple and double cotes
-"echo \"6789      \" \"    2345\"" # two coted blocks
-"echo \"6789      \"         \"    2345\"" # two coted blocks seperated with many spaces
-"echo \"6789      \"  test   \"    2345\"" # two coted blocks seperated with non coted block
-"echo nasruitersaui \"6789      \" ransuite  \"    2345\"   anruistenrasuit" # big one
-#"echo \"!\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\""
+"echo 'simple' \"double\"" # Mix simple and double cotes
+"echo \"6789\" \"2345\"" # two coted blocks
+"echo \"6789\"         \"2345\"" # two coted blocks seperated with many spaces
+"echo \"6789\"  test   \"2345\"" # two coted blocks seperated with non coted block
+"echo nasruitersaui \"6789\" ransuite  \"2345\"   anruistenrasuit" # big one
+
 # test all ASCII char: check they are used to split str like ';', '>', '<' or '|'
-"echo \"nrsatu;nrtsa\""
-"echo \"rasnt>inausrt\" > toto; cat toto"
-"echo \" nrastiu<rasntiu\" > toto; cat toto"
-"echo \"nrau|sntiu\" | cat"
-"ls ; echo \"nasruit><rnasuti\" > toto ; cat < toto"
+"echo \"nrsatu;nrtsa\"" # ;
+"echo \"rasnt>inausrt\" > toto; cat toto" # >
+"echo \"nrastiu<rasntiu\" > toto; cat toto" # <
+"echo \"nrau|sntiu\" | cat" # |
+"ls ; echo \"nasruit><rnasuti\" > toto ; cat < toto" # mix
+"echo \"!#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~\""
+# all ASCII char without ` and "
+
+### Spaces tests
+"echo \"6789      \"         \"    2345\""
+"echo \"6789      \"    arsnatuir     \"    2345\""
+"echo \"    67   89      \"         \"    23  45   \""
 
 ### Back cotes: pipe
 "echo \`ls\`" # back cotes
@@ -141,8 +148,6 @@ tests=(
 "\""
 "\`"
 
-### cotes non-closed
-
 ## Mix
 "rm $tmpf ; ls ; pwd; ls -a | cat -e | wc > $tmpf ; cat $tmpf ; rm $tmpf" # point-virgules, pipes et redirection
 "ls -a | cat -e | wc >> $tmpf ; cat $tmpf ; rm $tmpf" # pipes et double redirection