Skip to content

Commit

Permalink
README task
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Michel Gigault committed Nov 13, 2016
1 parent 44354d2 commit 0bd5413
Show file tree
Hide file tree
Showing 12 changed files with 455 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
It brings you an easy way to **add**, **maintain** and **run** integration tests, helping you to work step by step on your Shell implementation.

<!--START_TOTAL_TESTS-->
42ShellTester is currently packaged with **169 tests**.
42ShellTester is currently packaged with **177 tests**.
<!--END_TOTAL_TESTS-->

## Install
Expand Down Expand Up @@ -226,6 +226,16 @@ Also display tests that succeed (hidden by default).
* [003-run-until-failing](spec/bonuses/separators/or/003-run-until-failing)
* [004-parse-error-at-beginning](spec/bonuses/separators/or/004-parse-error-at-beginning)
* [005-parse-error-too-much-symbol](spec/bonuses/separators/or/005-parse-error-too-much-symbol)
* **[tilde-expansion/](spec/bonuses/tilde-expansion)**
* [001-expanded-with-HOME-1](spec/bonuses/tilde-expansion/001-expanded-with-HOME-1)
* [002-expanded-with-HOME-2](spec/bonuses/tilde-expansion/002-expanded-with-HOME-2)
* [003-expanded-with-PWD-1](spec/bonuses/tilde-expansion/003-expanded-with-PWD-1)
* [004-expanded-with-PWD-2](spec/bonuses/tilde-expansion/004-expanded-with-PWD-2)
* [005-expanded-with-OLDPWD-1](spec/bonuses/tilde-expansion/005-expanded-with-OLDPWD-1)
* [006-expanded-with-OLDPWD-2](spec/bonuses/tilde-expansion/006-expanded-with-OLDPWD-2)
* **[not-expanded/](spec/bonuses/tilde-expansion/not-expanded)**
* [001-not-expanded-with-HOME-1](spec/bonuses/tilde-expansion/not-expanded/001-not-expanded-with-HOME-1)
* [002-not-expanded-with-HOME-2](spec/bonuses/tilde-expansion/not-expanded/002-not-expanded-with-HOME-2)
* **[minishell/](spec/minishell)**
* **[binary/](spec/minishell/binary)**
* [001-binary-path-relative](spec/minishell/binary/001-binary-path-relative)
Expand Down
1 change: 1 addition & 0 deletions spec/bonuses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
* [builtins](./builtins)
* [redirections](./redirections)
* [separators](./separators)
* [tilde-expansion](./tilde-expansion)
52 changes: 52 additions & 0 deletions spec/bonuses/tilde-expansion/001-expanded-with-HOME-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 001-expanded-with-HOME-1

*[spec > bonuses > tilde-expansion](..) > 001-expanded-with-HOME-1*

The purpose of this test is to check that the symbol tilde `~` may be expanded with the environment variable HOME.
### What is done before test

```bash
export "HOME=/${GLOBAL_TOKEN}"

```

### Shell commands that are sent to the standard entry

```bash
./write_on_stdout ~

```

### What is expected on standard output

```bash
expected_to_not match_regex "~"
expected_to match_regex "^/${GLOBAL_TOKEN}$"

```

### Variables

The following variables may appear in this test:

* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
* ${**PATH**} -> The standard environment variable PATH
* ${**HOME**} -> The standard environment variable HOME

### Support binaries

The following binaries may appear in this test:


* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
52 changes: 52 additions & 0 deletions spec/bonuses/tilde-expansion/002-expanded-with-HOME-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 002-expanded-with-HOME-2

*[spec > bonuses > tilde-expansion](..) > 002-expanded-with-HOME-2*

The purpose of this test is to check that the symbol tilde `~` followed by the symbol slash `/` may be expanded with the environment variable HOME.
### What is done before test

```bash
export "HOME=/${GLOBAL_TOKEN}"

```

### Shell commands that are sent to the standard entry

```bash
./write_on_stdout ~/${GLOBAL_TOKEN}_SUBDIRECTORY

```

### What is expected on standard output

```bash
expected_to_not match_regex "~"
expected_to match_regex "^/${GLOBAL_TOKEN}/${GLOBAL_TOKEN}_SUBDIRECTORY$"

```

### Variables

The following variables may appear in this test:

* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
* ${**PATH**} -> The standard environment variable PATH
* ${**HOME**} -> The standard environment variable HOME

### Support binaries

The following binaries may appear in this test:


* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
53 changes: 53 additions & 0 deletions spec/bonuses/tilde-expansion/003-expanded-with-PWD-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 003-expanded-with-PWD-1

*[spec > bonuses > tilde-expansion](..) > 003-expanded-with-PWD-1*

The purpose of this test is to check that the symbol tilde `~` may be expanded with the environment variable PWD when followed by the symbol `+`.
### What is done before test

```bash
export "HOME=/${GLOBAL_TOKEN}"

```

### Shell commands that are sent to the standard entry

```bash
./write_on_stdout ~+

```

### What is expected on standard output

```bash
expected_to_not match_regex "~+"
expected_to_not match_regex "/${GLOBAL_TOKEN}+"
expected_to match_regex "^${GLOBAL_TMP_DIRECTORY}$"

```

### Variables

The following variables may appear in this test:

* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
* ${**PATH**} -> The standard environment variable PATH
* ${**HOME**} -> The standard environment variable HOME

### Support binaries

The following binaries may appear in this test:


* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
53 changes: 53 additions & 0 deletions spec/bonuses/tilde-expansion/004-expanded-with-PWD-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 004-expanded-with-PWD-2

*[spec > bonuses > tilde-expansion](..) > 004-expanded-with-PWD-2*

The purpose of this test is to check that the symbol tilde `~` may be expanded with the environment variable PWD when followed by the symbol `+`.
### What is done before test

```bash
export "HOME=/${GLOBAL_TOKEN}"

```

### Shell commands that are sent to the standard entry

```bash
./write_on_stdout ~+/${GLOBAL_TOKEN}_SUBDIRECTORY

```

### What is expected on standard output

```bash
expected_to_not match_regex "~+/${GLOBAL_TOKEN}_SUBDIRECTORY"
expected_to_not match_regex "/${GLOBAL_TOKEN}+/${GLOBAL_TOKEN}_SUBDIRECTORY"
expected_to match_regex "^${GLOBAL_TMP_DIRECTORY}/${GLOBAL_TOKEN}_SUBDIRECTORY$"

```

### Variables

The following variables may appear in this test:

* ${**GLOBAL_INSTALLDIR**} -> The installation directory of 42ShellTester
* ${**GLOBAL_TMP_DIRECTORY**} -> The temporary directory in which tests are executed
* ${**GLOBAL_TOKEN**} -> A token that changes value at launch time
* ${**PATH**} -> The standard environment variable PATH
* ${**HOME**} -> The standard environment variable HOME

### Support binaries

The following binaries may appear in this test:


* **[./display_env](http://github.com/we-sh/42ShellTester/tree/master/support/display-env)** -> A binary that iterates on `**envp` and write each element on standard output.
* **[./display_program_name](http://github.com/we-sh/42ShellTester/tree/master/support/display-program-name)** -> A binary that writes its name on standard ouput.
* **[./display_pwd](http://github.com/we-sh/42ShellTester/tree/master/support/display-pwd)** -> A binary that writes on standard output the absolute path of the current directory returned by `getcwd(3)`, encountered with the strings `PWD:` and `:PWD`.
* **[./exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/exit-with-status)** -> A binary that immediately exits with the status given as first argument.
* **[./read_on_stdin](http://github.com/we-sh/42ShellTester/tree/master/support/read-on-stdin)** -> A binary that reads on standard entry and write each line on standard output suffixed with the character `@` (e.g. same behavior as `cat -e` and the *newline* character). When `read(2)` returns `-1`, then the string `STDIN READ ERROR` is written on standard error.
* **[./sleep_and_exit_with_status](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-exit-with-status)** -> A binary that sleeps for a duration in seconds given as first argument and then exits with status given as second argument.
* **[./sleep_and_write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/sleep-and-write-on-stderr)** -> A binary that sleeps for a duration in seconds given as first argument and then writes on STDERR the string given as second argument without EOL.
* **[./write_on_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stderr)** -> A binary that writes on standard error the first given argument (the same behavior as `echo` but with only one argument) and exits with an error status code given as second argument. If no argument is given, it writes the string "write on stderr" and exit with status `1`.
* **[./write_on_stdout](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout)** -> A binary that writes on standard output the first given argument (the same behavior as `echo` but with only one argument). If no argument is given, it writes the string "write on stdout".
* **[./write_on_stdout_and_stderr](http://github.com/we-sh/42ShellTester/tree/master/support/write-on-stdout-and-stderr)** -> A binary that writes on standard output the first given argument, and writes on standard error the second given argument. If an argument is missing, it writes the strings "write on stdout" and "write on stderr".
Loading

0 comments on commit 0bd5413

Please sign in to comment.