diff --git a/error.md b/error.md index e165089..5c9f150 100644 --- a/error.md +++ b/error.md @@ -1,16 +1,39 @@ -1. redirection et quotes expansion +1. redirection & quotes expansion ``` - bash> echo "hello" > "file" - bash> ls + bash$ echo "hello" > "file" + bash$ ls file - bash> + bash$ ``` ``` - minishell> echo "hello" > "file" - minishell> ls + minishell$ echo "hello" > "file" + minishell$ ls '"file"' - minishell> + minishell$ ``` -2. +2. redirection & open + + `prompt$ > newfile` + create file `newfile` in bash, but not in minishell + +3. redirection & open + +ok `prompt$ echo "hello" > $not_a_variable` +ok does'nt create a file in bash, but does in minishell + +4. redirection & variables expansion + + ``` + export NEWVAR="newfile" + echo hello > $NEWVAR + ``` + create file "newfile" in bash, but a file named "'$NEWVAR'" in minishell + +5. redireciton & pipes + + `ls | < not_a_file cat` + gives an error about "not_a_file" and stop in bash, but in minishell it continues forever + (`< not_a_file cat` works fine in both bash and minishell) + diff --git a/tests/defaults/redirections.sh b/tests/defaults/redirections.sh index 3961f64..493a0ff 100644 --- a/tests/defaults/redirections.sh +++ b/tests/defaults/redirections.sh @@ -1,10 +1,8 @@ echo bonjour > $test ls -rm '$test' > log echo coucou ls -rm log cat < > @@ -14,63 +12,48 @@ cat > > > a ls > b < Makefile ls -rm a b echo > a Hello World! ls -rm a > a echo Hello World! ls -rm a echo bonjour > test\ 1 ls -rm test echo bonjour >>> test echo bonjour > > out ls -rm out echo 2 >> out1 > out2 ls -rm out1 out2 echo 2 > out1 >> out2 ls -rm out1 out2 cat < blablabla echo test > file test1 ls -rm file not_cmd bonjour > salut ls -rm salut >testt ls -rm testt >>testt ls -rm testt c >d @@ -81,12 +64,10 @@ cat a cat b cat c cat d -rm a b c d cat a | < b cat | cat > c | cat ls -rm a b c echo hello >a echo byebye >b @@ -96,11 +77,14 @@ ls cat a cat b cat c -rm a b c echo bonjour > $test w/ t ls +export TEST=newfile +echo hello > $TEST +ls + echo > "hardesttest.txt" echo adding stuff >> working.txt diff --git a/unitests.sh b/unitests.sh index cf60d36..24e68bd 100644 --- a/unitests.sh +++ b/unitests.sh @@ -143,7 +143,7 @@ cd $(dirname $0) function test_minishell { # execute commands in bash, and logs results - bash_execution=$( echo "$@" | bash 2>/dev/null ) + bash_execution=$( echo "$@" | bash -i 2>/dev/null ) delete_files minishell_execution=$( echo "$@" | ./minishell 2>/dev/null ) delete_files