Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all tests not required by the PDF into a new folder called extra #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 41 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,7 @@ I think from this you pretty much can figure it out, it isn't a big change :)

---

# How To Launch The Tester
Clone it to the root of your minishell

cd to the testers folder
## Options

```bash
bash tester.sh m
```
```bash
bash tester.sh vm
```
```bash
bash tester.sh ne
```
```bash
bash tester.sh d
```
```bash
bash tester.sh b
```
```bash
bash tester.sh a
```

---

# How To Install and Run

To install the script, copy and run following command:

```
Expand All @@ -105,6 +77,47 @@ mstest

---

# How To Launch The Tester

Do this if not using the `mstest` alias:
* Clone it to the root of your minishell
* cd to the tester's folder

## Options
Of course if using the `mstest` alias,
use that instead of `bash tester.sh`.
So a command should look like this:
`mstest help` or `mstest m` and etc.

When using the `mstest` alias, you don't
need to cd to the tester's folder.

Some options are not shown here,
run the help command to see them!

Print all options:
```bash
bash tester.sh help
```
Mandatory tests:
```bash
bash tester.sh m
```
Mandatory tests (with valgrind):
```bash
bash tester.sh vm
```
Tests for bonus from PDF:
```bash
bash tester.sh b
```
Tests both mandatory and bonus:
```bash
bash tester.sh a
```

---

# Updates
Tests without environment now are updated, separated and can be run with:

Expand Down
161 changes: 161 additions & 0 deletions cmds/extra/1_extra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# echo external
/bin/echo \$USER

/bin/echo \\$USER

/bin/echo \\\$USER

/bin/echo \\\\$USER

/bin/echo \\\\\$USER

/bin/echo \\\\\\\\\$USER

/bin/echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$USER \$PATH \\$PWD

# echo builtin
echo \$USER

echo \\$USER

echo \\\$USER

echo \\\\$USER

echo \\\\\$USER

echo \\\\\\\\\$USER

echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$USER \$PATH \\$PWD

# cd
cd --

cd ../../
cd -
cd -

echo cd ~
echo "cd ~"

pwd
cd ~
cd - ananas dot jpeg
pwd

pwd
cd ~ asd w dd q asd
pwd

pwd
cd ~
cd -
pwd

pwd
cd -
pwd

pwd
cd ~
pwd

cd '/////' 2>/dev/null

cd "doesntexist" 2>/dev/null

cd "wtf" 2>/dev/null

# env
env what

# export
export -TEST=100

export --TEST=123

# the ordering of export doesn't matter,
# for declare to still work
export

export TEST+=100

# unset
unset TES;T

unset -TEST

# pipes
ls | cat << stop | ls -la | cat << stop1 | ls | cat << stop2 | ls -la > > out | cat << stop3
fe
wf
fwe
f
stop
dw
stop1
dwasd
stop2
cat Makefile | ls > out
cat out
/bin/rm -f out

/bin/env | grep "_="

/bin/env | grep "SHLVL"

# scmds
touch "
"
/bin/rm -f "
"

# path fails
unset PATH
echo $PATH
/bin/ls
echo 1
cd -
echo 42

env -i ./minishell
cd /bin/
ls

pwd
cd ~/Desktop/
pwd

# syntax errors
~

.

..

>echo>
/bin/rm -f echo

<echo<
/bin/rm -f echo

>>echo>>
/bin/rm -f echo

\\\

>| echo wtf
/bin/rm -rf echo

# go wild
echo "env | /usr/bin/wc -l" | env -i $MINISHELL_PATH"/"$EXECUTABLE
echo $?

echo "ls" | env -i $MINISHELL_PATH"/"$EXECUTABLE
echo $?

echo "unset PATH" | env -i $MINISHELL_PATH"/"$EXECUTABLE
echo $?

# parsing hell
>| echo sure
16 changes: 1 addition & 15 deletions cmds/mand/0_compare_parsing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,6 @@

/bin/echo "'$?'"

/bin/echo \$USER

/bin/echo \\$USER

/bin/echo \\\$USER

/bin/echo \\\\$USER

/bin/echo \\\\\$USER

/bin/echo \\\\\\\\\$USER

/bin/echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\$USER \$PATH \\$PWD

/bin/echo "cat lol.c | cat > lol.c"

/bin/echo "cat lol.c '|' cat > lol.c"
Expand Down Expand Up @@ -179,4 +165,4 @@

/bin/echo ''totally logical''

/bin/echo ""'totally logical'""
/bin/echo ""'totally logical'""
4 changes: 0 additions & 4 deletions cmds/mand/10_parsing_hell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,3 @@ exit 9223372036854775805
exit 123"123"

<| echo ok

>| echo sure

cd --
Loading