{"id":15177226,"url":"https://github.com/ciavash/test-run","last_synced_at":"2025-10-01T16:31:05.078Z","repository":{"id":147482358,"uuid":"396753120","full_name":"CIAvash/Test-Run","owner":"CIAvash","description":"Test::Run - A Raku module for testing output of processes","archived":true,"fork":false,"pushed_at":"2021-08-29T16:25:06.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-28T14:04:30.334Z","etag":null,"topics":["command","exitcode","library","output","process","program","raku","run","stderr","stdin","stdout","test"],"latest_commit_sha":null,"homepage":"https://codeberg.org/CIAvash/Test-Run","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CIAvash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2021-08-16T10:59:38.000Z","updated_at":"2024-03-30T12:39:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f0e449e-c775-44c1-a87e-bd34f8649049","html_url":"https://github.com/CIAvash/Test-Run","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FTest-Run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FTest-Run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FTest-Run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CIAvash%2FTest-Run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CIAvash","download_url":"https://codeload.github.com/CIAvash/Test-Run/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234882624,"owners_count":18901301,"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":["command","exitcode","library","output","process","program","raku","run","stderr","stdin","stdout","test"],"created_at":"2024-09-27T14:04:13.528Z","updated_at":"2025-10-01T16:30:59.781Z","avatar_url":"https://github.com/CIAvash.png","language":"Raku","readme":"NAME\n====\n\nTest::Run - A module for testing output of processes.\n\nDESCRIPTION\n===========\n\nTest::Run is a module for testing `STDOUT`, `STDERR` and `exitcode` of processes.\n\nBy default it uses `cmp-ok` test function with smartmatch operator. But custom operators and test functions\ncan be used.\n\nSYNOPSIS\n========\n\n```raku\nuse Test::Run :runs_ok;\n\nruns_ok :args«$*EXECUTABLE -e 'put \"Hi!\"'», :out(\"Hi!\\n\"), 'Simple STDOUT test';\n# or\nTest::Run::runs_ok :args«$*EXECUTABLE -e 'put \"Hi!\"'», :out(\"Hi!\\n\"), 'Simple STDOUT test with full sub name';\n\n# Smartmatching against a regex\nruns_ok :args«$*EXECUTABLE -I. bin/program -v», :out(/'program-name v' [\\d+ %% '.'] ** 3 .+/), 'Prints version';\n\n# Smartmatching against Whatevercode\nruns_ok :args«$*EXECUTABLE -e 'note \"some long error message\"; exit 1;'»,\n        :err(*.contains('error message')),\n        :exitcode(* \u003e 0);\n\nruns_ok :args«$*EXECUTABLE -»,\n        :in('put \"Hi!\"; note \"Bye!\"; exit 1'), :out(\"Hi!\\n\"), :err(\"Bye!\\n\"), :exitcode(1),\n        'Output test';\n\n# Using custom test function\nuse Test::Differences;\nruns_ok :args«@args[] $command», :out($expected_data), \"Prints correctly\", :test_stdout(\u0026eq_or_diff);\n```\n\nINSTALLATION\n============\n\nYou need to have [Raku](https://www.raku-lang.ir/en) and [zef](https://github.com/ugexe/zef), then run:\n\n```console\nzef install 'Test::Run:auth\u003czef:CIAvash\u003e'\n```\n\nor if you have cloned the repo:\n\n```console\nzef install .\n```\n\nTESTING\n=======\n\n```console\nprove -ve 'raku -I.' --ext rakutest\n```\n\nSUBS\n====\n\n## sub runs_ok\n\n```raku\nsub runs_ok(\n    Str $description?, :@args!, :$in, :$out, :$err, Int :$exitcode = 0,\n    Bool:D :$bin = Bool::False,\n    Bool:D :$bin_stdout = $bin,\n    Bool:D :$bin_stderr = $bin,\n    :$op = \u0026[~~],\n    :$op_stdout is copy = $op,\n    :$op_stderr is copy = $op,\n    :\u0026test_stdout,\n    :\u0026test_stderr\n) returns Mu\n```\n\nTakes program arguments, optionally `STDIN`, expected `STDOUT` and `STDERR` and `exitcode`, binary mode(can be separate for `STDOUT` and `STDERR`), operator used for `cmp-ok` (can be separate for `STDOUT` and `STDERR`), custom test function to run on `STDOUT` and/or `STDERR`.\n\nThen runs 3 tests for `exitcode`, `STDERR`, `STDOUT` in a `subtest`\n\n### Bool:D :$bin\n\nWhether output is binary(`Blob`)\n\n### Bool:D :$bin_stdout\n\nWhether STDOUT is binary(`Blob`)\n\n### Bool:D :$bin_stderr\n\nWhether STDERR is binary(`Blob`)\n\n### Mu $op\n\nComparison operator for `cmp-ok`\n\n### Mu $op_stdout\n\nComparison operator for `cmp-ok` and `STDOUT`\n\n### Mu $op_stderr\n\nComparison operator for `cmp-ok` and `STDERR`\n\n### Callable \u0026test_stdout\n\nCustom test function for `STDOUT`\n\n### Callable \u0026test_stderr\n\nCustom test function for `STDERR`\n\n## sub run_proc\n\n```raku\nsub run_proc(:@args, :$in, Bool:D :$bin = Bool::False) returns List\n```\n\nRuns process with `Proc`, returns a list of `STDOUT`, `STDERR`, `exitcode`.\n\nCurrently unused because it returns exitcode 1 for nonexistent programs,\nsinks \u0026 dies when handles are closed\n\nSee https://github.com/rakudo/rakudo/issues/1590 and https://github.com/rakudo/rakudo/issues/3720\n\n## sub run_proc_async\n\n```raku\nsub run_proc_async(\n    :@args,\n    :$in,\n    Bool:D :$bin = Bool::False,\n    Bool:D :$bin_stdout = $bin,\n    Bool:D :$bin_stderr = $bin\n) returns List\n```\n\nRuns process with `Proc::Async`, returns a list of `STDOUT`, `STDERR`, `exitcode`\n\nREPOSITORY\n==========\n\nhttps://github.com/CIAvash/Test-Run/\n\nBUG\n===\n\nhttps://github.com/CIAvash/Test-Run/issues\n\nAUTHOR\n======\n\nSiavash Askari Nasr - https://www.ciavash.name\n\nCOPYRIGHT\n=========\n\nCopyright © 2021 Siavash Askari Nasr\n\nLICENSE\n=======\n\nThis file is part of Test::Run.\n\nTest::Run is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nTest::Run is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with Test::Run. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciavash%2Ftest-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciavash%2Ftest-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciavash%2Ftest-run/lists"}