{"id":22505801,"url":"https://github.com/mcombeau/minitester-minishell-tester","last_synced_at":"2025-09-18T23:51:34.656Z","repository":{"id":172208256,"uuid":"540460338","full_name":"mcombeau/minitester-minishell-tester","owner":"mcombeau","description":"A simple tester for 42 school project minishell.","archived":false,"fork":false,"pushed_at":"2024-07-06T06:54:31.000Z","size":16844,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-06T07:55:55.158Z","etag":null,"topics":["bash-script","minishell-tester","minishell42"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcombeau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-23T13:45:10.000Z","updated_at":"2024-07-06T06:54:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b45542e-131e-48ff-a726-22bd14e41e1c","html_url":"https://github.com/mcombeau/minitester-minishell-tester","commit_stats":null,"previous_names":["mcombeau/minitester-minishell-tester"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcombeau%2Fminitester-minishell-tester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcombeau%2Fminitester-minishell-tester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcombeau%2Fminitester-minishell-tester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcombeau%2Fminitester-minishell-tester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcombeau","download_url":"https://codeload.github.com/mcombeau/minitester-minishell-tester/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543661,"owners_count":17934529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","minishell-tester","minishell42"],"created_at":"2024-12-07T00:34:07.833Z","updated_at":"2025-09-18T23:51:29.594Z","avatar_url":"https://github.com/mcombeau.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minitester: A simple Minishell tester\n\nA simple tester for 42 school project minishell.\n\n## Tests Performed\n\nThis tester compares your Minishell output (file output, standard output, standard error and exit codes) against Bash over 600+ tests:\n\n- Execution tests: executables with relative and absolute paths, piped commands (`|`)\n- Parsing \u0026 syntax error tests,\n- Quote handling tests (`\"` and `'`)\n- Environment variable expansion tests (`$`)\n- Builtin tests: `echo`, `env`, `export`, `unset`, `pwd`, `cd`, `exit`\n- Redirection tests: `\u003c`, `\u003e`, `\u003e\u003e`\n- Exit status tests (`$?`)\n- Tests with no environment\n\nIf the output does not match, the tester displays the differences.\n\nPython tester:\n![minitester execution python](https://github.com/mcombeau/minitester-minishell-tester/blob/main/screenshots/minitester-python.png)\n\nHowever, it does not test for memory leaks or for Norm errors. Some tests must still be performed manually, such as for signals and `ctrl-D` functionality, as well as for the heredoc.\n\n## Prerequisites\n\nThis tester requires Python3.\n\nTo use this tester, your minishell must support the `-c` option, which allows passing a command as an argument, like Bash:\n\n```bash\n$ bash -c 'echo hello world | cat -e'\nhello world$\n$ ./minishell -c 'echo hello world | cat -e'\nhello world$\n```\n\nThis way, the line to parse is in your main function's `argv[2]`, instead of a `readline` input.\n\nThis test also requires a basic implementation of the semicolon `;` operator although the minishell subject does not. The semicolon operator allows passing multiple commands to be perfomed sequentially:\n\n```Bash\n$ bash -c 'echo hello | echo world'\nworld\n$ bash -c 'echo hello; echo world'\nhello\nworld\n```\n\nThe easiest way to implement this is by using `ft_split` on your `argv[2]`. For example, an implementation might be:\n\n```C\nint\tmain(int argc, char **argv, char **envp)\n{\n\tchar\t*readline_input;\n\tchar\t**arg_input;\n\tint\t\ti;\n\n\tif (argc == 3 \u0026\u0026 ft_strcmp(argv[1], \"-c\") == 0 \u0026\u0026 argv[2])\n\t{\n\t\targ_input = ft_split(argv[2], ';');\n\t\tif (!arg_input)\n\t\t\t// exit\n\t\ti = 0;\n\t\twhile (arg_input[i])\n\t\t{\n\t\t\t// Parse arg_input[i]\n\t\t\t// Execute arg_input[i]\n\t\t\ti++;\n\t\t}\n\t}\n\telse\n\t{\n\t\twhile (1)\n\t\t{\n\t\t\treadline_input = readline(PROMPT);\n\t\t\t//Parse readline input\n\t\t\t//Execute readline input\n\t\t}\n\t}\n\t// Free data and exit minishell when done\n}\n```\n\nThese requirements are necessary to be able to properly test builtins like `export` and `unset` (to be able to check the environment afterwards) as well as `cd` (to be able to check `pwd` afterwards)\n\n## Usage\n\nClone this repository in your minishell directory.\n\n```\ngit clone git@github.com:mcombeau/minitester-minishell-tester.git\n```\n\nIf you wish to clone it elsewhere, please edit `minishell_path` in `tester/config.py` to point to your minishell binary.\n\nTo run the program:\n\n```bash\n$ python3 minitester.py\n```\n\nThe tester runs the tests specified (one per line) in the `minishell_tests.txt` file. Each block of tests can be run independently (see options below).\n\n```bash\nusage: python3 minitester.py [-h] [-a] [-l] [-t TESTBLOCK] [-c]\n```\n\nOptions are:\n\n- `-h`: Show the help message\n- `-a`: Run all test blocks\n- `-l`: List all available test blocks\n- `-t TESTBLOCK`: Specify tests blocks to run (can be used multiple times)\n- `-c`: Display colored output (default no color)\n\nFor example, to run only tests related to the `echo` built in and display the results with color, you can run:\n\n```bash\npython3 minitester.py -c -t echo -t echo-no-env\n```\n\n---\n\nMade by mcombeau: mcombeau@student.42.fr | LinkedIn: [mcombeau](https://www.linkedin.com/in/mia-combeau-86653420b/) | Website: [codequoi.com](https://www.codequoi.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcombeau%2Fminitester-minishell-tester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcombeau%2Fminitester-minishell-tester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcombeau%2Fminitester-minishell-tester/lists"}