diff --git a/src/main.c b/src/main.c index 33562618..f1057971 100644 --- a/src/main.c +++ b/src/main.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) { errx(1, "Error while creating lexer"); } - + int val = parser_loop(lexer, pretty_print_enabled); if (val == 2) { diff --git a/tests/quote/double_quote/double_quote10.test b/tests/quote/double_quote/double_quote10.test new file mode 100644 index 00000000..dbcc50e8 --- /dev/null +++ b/tests/quote/double_quote/double_quote10.test @@ -0,0 +1 @@ +a=1;echo "$a\"$a" \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote11.test b/tests/quote/double_quote/double_quote11.test new file mode 100644 index 00000000..02ebdd8a --- /dev/null +++ b/tests/quote/double_quote/double_quote11.test @@ -0,0 +1 @@ +echo "Special characters: !@#%$^&*()" \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote12.test b/tests/quote/double_quote/double_quote12.test new file mode 100644 index 00000000..bb7178ea --- /dev/null +++ b/tests/quote/double_quote/double_quote12.test @@ -0,0 +1 @@ +bb=1; echo "$ddd\"" \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote5.test b/tests/quote/double_quote/double_quote5.test new file mode 100644 index 00000000..addeff31 --- /dev/null +++ b/tests/quote/double_quote/double_quote5.test @@ -0,0 +1 @@ +a=1;echo "$a\"" \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote6.test b/tests/quote/double_quote/double_quote6.test new file mode 100644 index 00000000..f5c6502a --- /dev/null +++ b/tests/quote/double_quote/double_quote6.test @@ -0,0 +1 @@ +a=1;echo "idiej$a:jodejoj" "$a" "dikefok"' \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote7.test b/tests/quote/double_quote/double_quote7.test new file mode 100644 index 00000000..bbd38d37 --- /dev/null +++ b/tests/quote/double_quote/double_quote7.test @@ -0,0 +1 @@ +a=1;echo "lpikopo"pojo^é$ \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote8.test b/tests/quote/double_quote/double_quote8.test new file mode 100644 index 00000000..79747dfa --- /dev/null +++ b/tests/quote/double_quote/double_quote8.test @@ -0,0 +1,4 @@ +a=1;echo "lpikopo\ + + +" \ No newline at end of file diff --git a/tests/quote/double_quote/double_quote9.test b/tests/quote/double_quote/double_quote9.test new file mode 100644 index 00000000..9e4fda48 --- /dev/null +++ b/tests/quote/double_quote/double_quote9.test @@ -0,0 +1 @@ +a=1;echo "lpikopo\$$\$$\\$\$\*\\*\\\*\*\\***\ " \ No newline at end of file diff --git a/tests/quote/double_quote/testsuite.sh b/tests/quote/double_quote/testsuite.sh index 31a008fb..b2a7e20a 100644 --- a/tests/quote/double_quote/testsuite.sh +++ b/tests/quote/double_quote/testsuite.sh @@ -1,4 +1,12 @@ run_test double_quote1.test run_test double_quote2.test run_test double_quote3.test -run_test double_quote4.test \ No newline at end of file +run_test double_quote4.test +run_test double_quote5.test +run_test double_quote6.test +run_test double_quote7.test +run_test double_quote8.test +run_test double_quote9.test +run_test double_quote10.test +run_test double_quote11.test +run_test double_quote12.test \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error1.test b/tests/quote/double_quote_error/double_quote_error1.test new file mode 100644 index 00000000..58c5313d --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error1.test @@ -0,0 +1 @@ +bb=1; echo "$bb \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error2.test b/tests/quote/double_quote_error/double_quote_error2.test new file mode 100644 index 00000000..a17274b9 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error2.test @@ -0,0 +1 @@ +bb=1; echo "$ddd\" \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error3.test b/tests/quote/double_quote_error/double_quote_error3.test new file mode 100644 index 00000000..74034281 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error3.test @@ -0,0 +1 @@ +tata=1; echo "${tata} \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error4.test b/tests/quote/double_quote_error/double_quote_error4.test new file mode 100644 index 00000000..a2a9f7a5 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error4.test @@ -0,0 +1 @@ +tata=1; echo "${tata}\" \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error5.test b/tests/quote/double_quote_error/double_quote_error5.test new file mode 100644 index 00000000..6efb40a9 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error5.test @@ -0,0 +1 @@ +tata=1; echo "${tata" \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error6.test b/tests/quote/double_quote_error/double_quote_error6.test new file mode 100644 index 00000000..1d3311c7 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error6.test @@ -0,0 +1 @@ +tata=1; echo "$ \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error7.test b/tests/quote/double_quote_error/double_quote_error7.test new file mode 100644 index 00000000..33dc7b55 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error7.test @@ -0,0 +1 @@ +tata=1; echo "$lff \ No newline at end of file diff --git a/tests/quote/double_quote_error/double_quote_error8.test b/tests/quote/double_quote_error/double_quote_error8.test new file mode 100644 index 00000000..24abd685 --- /dev/null +++ b/tests/quote/double_quote_error/double_quote_error8.test @@ -0,0 +1 @@ +tata=1; echo \"${tata}" \ No newline at end of file diff --git a/tests/quote/double_quote_error/testsuite.sh b/tests/quote/double_quote_error/testsuite.sh new file mode 100644 index 00000000..3e0ecf65 --- /dev/null +++ b/tests/quote/double_quote_error/testsuite.sh @@ -0,0 +1,8 @@ +run_test double_quote_error1.test +run_test double_quote_error2.test +run_test double_quote_error3.test +run_test double_quote_error4.test +run_test double_quote_error5.test +run_test double_quote_error6.test +run_test double_quote_error7.test +run_test double_quote_error8.test \ No newline at end of file diff --git a/tests/quote/single_quote_error/testsuite.sh b/tests/quote/single_quote_error/testsuite.sh index db5c2be1..e6726832 100644 --- a/tests/quote/single_quote_error/testsuite.sh +++ b/tests/quote/single_quote_error/testsuite.sh @@ -1,5 +1,5 @@ run_test single_quote_error1.test run_test single_quote_error2.test run_test single_quote_error3.test -run_test single_quote_errorMouli1.test -run_test single_quote_errorMouli2.test \ No newline at end of file +run_test single_quoteMouli1.test +run_test single_quoteMouli2.test \ No newline at end of file diff --git a/tests/redirections/redir_&input/complex1.test b/tests/redirections/redir_&input/complex1.test new file mode 100644 index 00000000..7a7125d5 --- /dev/null +++ b/tests/redirections/redir_&input/complex1.test @@ -0,0 +1,5 @@ +echo 'hello' > input.txt +ls > output.txt 2<&1 < input.txt +cat output.txt +cat input.txt +rm input.txt output.txt \ No newline at end of file diff --git a/tests/redirections/redir_&input/testsuite.sh b/tests/redirections/redir_&input/testsuite.sh index 0a7672ab..4370aa69 100644 --- a/tests/redirections/redir_&input/testsuite.sh +++ b/tests/redirections/redir_&input/testsuite.sh @@ -1 +1,2 @@ -run_test simple1.test \ No newline at end of file +run_test simple1.test +run_test complex1.test \ No newline at end of file diff --git a/tests/redirections/redir_&output/error1.test b/tests/redirections/redir_&output/error1.test new file mode 100644 index 00000000..ce85a5e4 --- /dev/null +++ b/tests/redirections/redir_&output/error1.test @@ -0,0 +1,3 @@ +t 2>& file; +cat file +rm file \ No newline at end of file diff --git a/tests/redirections/redir_&output/input.txt b/tests/redirections/redir_&output/input.txt new file mode 100644 index 00000000..9adc6a3b --- /dev/null +++ b/tests/redirections/redir_&output/input.txt @@ -0,0 +1,5 @@ +1 +3 +2 +7 +0 diff --git a/tests/redirections/redir_&output/simple2.test b/tests/redirections/redir_&output/simple2.test index ce85a5e4..5bc16279 100644 --- a/tests/redirections/redir_&output/simple2.test +++ b/tests/redirections/redir_&output/simple2.test @@ -1,3 +1,3 @@ -t 2>& file; -cat file -rm file \ No newline at end of file +ls -l non_existent_directory >& output_and_error.txt +if [ -s output_and_error.txt ]; then echo tata; fi +rm -f output_and_error.txt \ No newline at end of file diff --git a/tests/redirections/redir_&output/simple4.test b/tests/redirections/redir_&output/simple4.test new file mode 100644 index 00000000..45715188 --- /dev/null +++ b/tests/redirections/redir_&output/simple4.test @@ -0,0 +1,8 @@ +echo '1 +3 +2 +7 +0' > input.txt +sort < input.txt >& sorted_output.txt +cat sorted_output.txt +rm input.txt sorted_output.txt \ No newline at end of file diff --git a/tests/redirections/redir_&output/testsuite.sh b/tests/redirections/redir_&output/testsuite.sh index 673d84a4..d5b41e22 100644 --- a/tests/redirections/redir_&output/testsuite.sh +++ b/tests/redirections/redir_&output/testsuite.sh @@ -1,3 +1,4 @@ run_test simple1.test run_test simple2.test -run_test simple3.test \ No newline at end of file +run_test simple3.test +run_test error1.test \ No newline at end of file diff --git a/tests/redirections/redir_input/file.txt b/tests/redirections/redir_input/file.txt index e69de29b..5ab2f8a4 100644 --- a/tests/redirections/redir_input/file.txt +++ b/tests/redirections/redir_input/file.txt @@ -0,0 +1 @@ +Hello \ No newline at end of file diff --git a/tests/redirections/redir_input/simple1.test b/tests/redirections/redir_input/simple1.test index d85f007f..f7e91bcc 100644 --- a/tests/redirections/redir_input/simple1.test +++ b/tests/redirections/redir_input/simple1.test @@ -1 +1,3 @@ -ls < file.txt \ No newline at end of file +echo 'hello' > file.txt +ls < file.txt +rm file.txt diff --git a/tests/redirections/redir_output/double_redir.test b/tests/redirections/redir_output/double_redir.test new file mode 100644 index 00000000..e30978a8 --- /dev/null +++ b/tests/redirections/redir_output/double_redir.test @@ -0,0 +1,4 @@ +ls -l non_existent_directory 1> success.txt 2> error.txt; echo tata +cat success.txt +if [ -s error.txt ]; then echo tata;fi +rm success.txt error.txt \ No newline at end of file diff --git a/tests/redirections/redir_output/simple2.test b/tests/redirections/redir_output/simple2.test index c59d8c28..898bf83d 100644 --- a/tests/redirections/redir_output/simple2.test +++ b/tests/redirections/redir_output/simple2.test @@ -1,3 +1,4 @@ wrong_command 2>file +if [ -s error.txt ]; then echo tata;fi # cat file --> working but not the same stderr message rm file \ No newline at end of file diff --git a/tests/redirections/redir_output/testsuite.sh b/tests/redirections/redir_output/testsuite.sh index bf61e093..73a786ec 100644 --- a/tests/redirections/redir_output/testsuite.sh +++ b/tests/redirections/redir_output/testsuite.sh @@ -1,2 +1,3 @@ run_test simple1.test -run_test simple2.test \ No newline at end of file +run_test simple2.test +run_test double_redir.test \ No newline at end of file diff --git a/tests/variable/variable/condition_variable2.test b/tests/variable/variable/condition_variable2.test new file mode 100644 index 00000000..b549e93f --- /dev/null +++ b/tests/variable/variable/condition_variable2.test @@ -0,0 +1 @@ +a=true; if $a; then echo atat;fi \ No newline at end of file diff --git a/tests/variable/variable/simple_variable4.tet b/tests/variable/variable/simple_variable4.test similarity index 100% rename from tests/variable/variable/simple_variable4.tet rename to tests/variable/variable/simple_variable4.test diff --git a/tests/variable/variable/testsuite.sh b/tests/variable/variable/testsuite.sh index 2cfb2a1c..66574b2c 100644 --- a/tests/variable/variable/testsuite.sh +++ b/tests/variable/variable/testsuite.sh @@ -7,4 +7,5 @@ run_test simple_variable6.test run_test simple_variable7.test run_test simple_variable8.test run_test condition_variable1.test +run_test condition_variable2.test run_test environment_variable.test \ No newline at end of file diff --git a/tests/variable/variable_error/condition_variable_error1.test b/tests/variable/variable_error/condition_variable_error1.test new file mode 100644 index 00000000..0050be05 --- /dev/null +++ b/tests/variable/variable_error/condition_variable_error1.test @@ -0,0 +1 @@ +a=1; if $a; then echo atat;fi \ No newline at end of file diff --git a/tests/variable/variable_error/simple_error_variable3.test b/tests/variable/variable_error/simple_error_variable3.test new file mode 100644 index 00000000..662ef107 --- /dev/null +++ b/tests/variable/variable_error/simple_error_variable3.test @@ -0,0 +1 @@ +$1 ${a} ${b} b=2; b=1; echo ${b} \ No newline at end of file diff --git a/tests/variable/variable_error/testsuite.sh b/tests/variable/variable_error/testsuite.sh index 54ac8cf2..ac40b50a 100644 --- a/tests/variable/variable_error/testsuite.sh +++ b/tests/variable/variable_error/testsuite.sh @@ -1,3 +1,5 @@ run_test while_variable_error1.test run_test simple_error_variable1.test -run_test simple_error_variable2.test \ No newline at end of file +run_test simple_error_variable2.test +run_test simple_error_variable3.test +run_test conditional_variable_error1.test \ No newline at end of file