From 3cb9cde0bc2c2ed137318e7422cafd308fca37bd Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Mon, 2 Dec 2024 16:53:26 +0100 Subject: [PATCH] CI test for update as Raku community module --- .github/workflows/linux.yml | 26 ++++ .github/workflows/macos.yml | 26 ++++ .github/workflows/test.yaml | 11 -- .github/workflows/windows.yml | 26 ++++ Changes | 4 +- META6.json | 30 ++-- README.md | 137 +++++++----------- SPECIFICATION.md | 25 ++-- dist.ini | 11 ++ doc/.Test-When.rakudoc.swp | Bin 0 -> 16384 bytes doc/Test-When.rakudoc | 168 ++++++++++++++++++++++ lib/Test/{When.pm6 => When.rakumod} | 2 + run-tests | 66 +++++++++ t/{00-use.t => 00-use.rakutest} | 0 t/{01-env-vars.t => 01-env-vars.rakutest} | 5 +- 15 files changed, 411 insertions(+), 126 deletions(-) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml delete mode 100644 .github/workflows/test.yaml create mode 100644 .github/workflows/windows.yml create mode 100644 dist.ini create mode 100644 doc/.Test-When.rakudoc.swp create mode 100644 doc/Test-When.rakudoc rename lib/Test/{When.pm6 => When.rakumod} (97%) create mode 100644 run-tests rename t/{00-use.t => 00-use.rakutest} (100%) rename t/{01-env-vars.t => 01-env-vars.rakutest} (99%) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..ab53183 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,26 @@ +name: Linux + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + matrix: + os: + - ubuntu-latest + raku-version: + - 'latest' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Run Special Tests + run: raku run-tests -i diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..de79738 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,26 @@ +name: MacOS + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + matrix: + os: + - macos-latest + raku-version: + - 'latest' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Run Special Tests + run: raku run-tests -i diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 2f91278..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,11 +0,0 @@ -name: "Tests on source" -on: [ push, pull_request ] -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Test via install - uses: JJ/raku-test-action@v1 - - - diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..557c8d5 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,26 @@ +name: Windows + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + matrix: + os: + - windows-latest + raku-version: + - 'latest' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Run Special Tests + run: raku run-tests -i diff --git a/Changes b/Changes index 1dbc6f9..4c1a32c 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ -Revision History for 'Test::When' Perl 6 Distribution +Revision History for Test-When + +{{$NEXT}} 1.001001 2016-05-19 - First version released on an unsuspecting world diff --git a/META6.json b/META6.json index 94e2d48..ee17250 100644 --- a/META6.json +++ b/META6.json @@ -1,19 +1,25 @@ { - "name": "Test::When", - "description": "Selectively run tests based on the environment and installed modules and libs", - "version": "1.001009", - "perl": "6.c", + "auth": "zef:raku-community-modules", "authors": [ "Zoffix Znet" ], - "auth": "zef:raku-community-modules", - "depends": [], - "test-depends": [ - "Test" + "build-depends": [ ], + "depends": [ + ], + "description": "Selectively run tests based on the environment and installed modules and libs", + "license": "Artistic-2.0", + "name": "Test::When", + "perl": "6.c", "provides": { - "Test::When": "lib/Test/When.pm6" + "Test::When": "lib/Test/When.rakumod" }, - "license": "Artistic-2.0", - "source-url": "https://github.com/raku-community-modules/Test-When" -} \ No newline at end of file + "resources": [ + ], + "source-url": "https://github.com/raku-community-modules/Test-When.git", + "tags": [ + ], + "test-depends": [ + ], + "version": "1.001009" +} diff --git a/README.md b/README.md index d3f1e08..19b6f1e 100644 --- a/README.md +++ b/README.md @@ -1,155 +1,122 @@ -# NAME [![Tests on source](https://github.com/raku-community-modules/Test-When/actions/workflows/test.yaml/badge.svg)](https://github.com/raku-community-modules/Test-When/actions/workflows/test.yaml) +[![Actions Status](https://github.com/raku-community-modules/Test-When/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/Test-When/actions) [![Actions Status](https://github.com/raku-community-modules/Test-When/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/Test-When/actions) [![Actions Status](https://github.com/raku-community-modules/Test-When/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/Test-When/actions) + +NAME +==== Test::When - Selectively run tests based on the environment and installed modules and libs -# TABLE OF CONTENTS -- [NAME](#name) -- [SYNOPSIS](#synopsis) -- [UNIMPLEMENTED / SPEC](#unimplemented--spec) -- [DESCRIPTION](#description) -- [USAGE](#usage) - - [Environmental Variable Controlled Tests](#environmental-variable-controlled-tests) - - [`smoke`](#smoke) - - [`interactive`](#interactive) - - [`extended`](#extended) - - [`release`](#release) - - [`author`](#author) - - [`online`](#online) - - [Meaning of the Respected Environmental Variables](#meaning-of-the-respected-environmental-variables) -- [REPOSITORY](#repository) -- [BUGS](#bugs) -- [AUTHOR](#author-1) -- [LICENSE](#license) - -# SYNOPSIS +SYNOPSIS +======== ```raku - use Test::When , - :modules, - :libs( 'someClib', any() ); +use Test::When , + :modules, + :libs( 'someClib', any() ); ``` -# UNIMPLEMENTED / SPEC +UNIMPLEMENTED / SPEC +==================== -The `:modules` and `:libs` restrictions aren't yet implemented, but will -be soon. Checkout the [SPECIFICATION](SPECIFICATION.md) for details on what -they will do. +The `:modules` and `:libs` restrictions aren't yet implemented, but will be soon. Checkout the [SPECIFICATION](SPECIFICATION.md) for details on what they will do. -# DESCRIPTION +DESCRIPTION +=========== -This module lets you write selective tests that will only run when user requested, say, network tests to run, or when the runner of the tests -explicitly requested any interactive tests to be avoided. These checks are -heavily based on the decisions by the [Lancaster Consensus](https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts) +This module lets you write selective tests that will only run when user requested, say, network tests to run, or when the runner of the tests explicitly requested any interactive tests to be avoided. These checks are heavily based on the decisions by the [Lancaster Consensus](https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts). -*Currently unimplemented.* The module also allows run tests only when a -specific module or C library are installed. This is handy when your -module offers extra optional functionality dependent on extra stuff, for -example. +*Currently unimplemented.* The module also allows run tests only when a specific module or C library are installed. This is handy when your module offers extra optional functionality dependent on extra stuff, for example. -# USAGE +USAGE +===== -The type of tests your test file represents is specified on the `use` line -of `Test::When` module. +The type of tests your test file represents is specified on the `use` line of `Test::When` module. -## Environmental Variable Controlled Tests +Environmental Variable Controlled Tests +--------------------------------------- ```raku - use Test::When ; +use Test::When ; ``` -The type of test environment to look for is set by positional arguments -provided on the `use` line. Multiple positional arguments can be -combined. Whether your tests run depends on the set -environmental variables. +The type of test environment to look for is set by positional arguments provided on the `use` line. Multiple positional arguments can be combined. Whether your tests run depends on the set environmental variables. The following positional arguments are supported: -### `smoke` +### smoke ```raku - use Test::When ; +use Test::When ; ``` Tests to run when either `AUTOMATED_TESTING` or `ALL_TESTING` env vars are true. -### `interactive` +### interactive ```raku - use Test::When ; +use Test::When ; ``` -Tests must **NOT** be run when `NONINTERACTIVE_TESTING` is set to true, -unless `ALL_TESTING` is also set to true. +Tests must **NOT** be run when `NONINTERACTIVE_TESTING` is set to true, unless `ALL_TESTING` is also set to true. -### `extended` +### extended ```raku - use Test::When ; +use Test::When ; ``` -Tests to be run when either `EXTENDED_TESTING`, `RELEASE_TESTING`, -or `ALL_TESTING` env var is set to true. +Tests to be run when either `EXTENDED_TESTING`, `RELEASE_TESTING`, or `ALL_TESTING` env var is set to true. -### `release` +### release ```raku - use Test::When ; +use Test::When ; ``` Tests to be run when `RELEASE_TESTING` or `ALL_TESTING` env var is set to true. -### `author` +### author ```raku - use Test::When ; +use Test::When ; ``` Tests to be run when `AUTHOR_TESTING` or `ALL_TESTING` env var is set to true. -### `online` +### online ```raku - use Test::When ; +use Test::When ; ``` Tests to be run when `ONLINE_TESTING` or `ALL_TESTING` env var is set to true. ### Meaning of the Respected Environmental Variables -* `AUTOMATED_TESTING`: if true, tests are being run by an automated testing facility and not as part of the installation of a module; CPAN smokers must set this to true; CPAN clients (e.g. `zef`) must not set this. - -* `NONINTERACTIVE_TESTING`: if true, tests should not attempt to interact with a user; output may not be seen and prompts will not be answered. + * `AUTOMATED_TESTING`: if true, tests are being run by an automated testing facility and not as part of the installation of a module; smokers must set this to true; clients (e.g. `zef`) must not set this. -* `EXTENDED_TESTING`: if true, the user or process running tests is willing to run optional tests that may take extra time or resources to complete. Such tests must not include any development or QA tests. Only tests of runtime functionality should be included. + * `NONINTERACTIVE_TESTING`: if true, tests should not attempt to interact with a user; output may not be seen and prompts will not be answered. -* `RELEASE_TESTING`: if true, tests are being run as part of a release QA process; CPAN clients must not set this variable. + * `EXTENDED_TESTING`: if true, the user or process running tests is willing to run optional tests that may take extra time or resources to complete. Such tests must not include any development or QA tests. Only tests of runtime functionality should be included. -* `AUTHOR_TESTING`: if true, tests are being run as part of an author's personal development process; such tests may or may not be run prior to release. CPAN clients must not set this variable. Distribution packagers (ppm, deb, rpm, etc.) should not set this variable. + * `RELEASE_TESTING`: if true, tests are being run as part of a release QA process; clients must not set this variable. -* `ONLINE_TESTING`: unless true, tests must not attempt to access a network - resource (such a website or attempt to query a network interface). + * `AUTHOR_TESTING`: if true, tests are being run as part of an author's personal development process; such tests may or may not be run prior to release. clients must not set this variable. Distribution packagers (ppm, deb, rpm, etc.) should not set this variable. -* `ALL_TESTING`: if true, all possible tests will be run. That is, this -module will NOT skip any tests it could possibly skip under other -environment. This **includes** tests that require a particular module -or C library to be installed. + * `ONLINE_TESTING`: unless true, tests must not attempt to access a network resource (such a website or attempt to query a network interface). -# REPOSITORY + * `ALL_TESTING`: if true, all possible tests will be run. That is, this module will NOT skip any tests it could possibly skip under other environment. This **includes** tests that require a particular module or C library to be installed. -Fork this module on GitHub: -https://github.com/raku-community-modules/Test-When +AUTHOR +====== -# BUGS +Zoffix Znet -To report bugs or request features, please use -https://github.com/raku-community-modules/Test-When/issues +COPYRIGHT AND LICENSE +===================== -# AUTHOR +Copyright 2016 - 2017 Zoffix Znet -Zoffix Znet (http://zoffix.com/) +Copyright 2020 - 2024 Raku Community -# LICENSE +This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. -You can use and distribute this module under the terms of the -The Artistic License 2.0. See the `LICENSE` file included in this -distribution for complete details. diff --git a/SPECIFICATION.md b/SPECIFICATION.md index 00e0a62..d32b20f 100644 --- a/SPECIFICATION.md +++ b/SPECIFICATION.md @@ -12,13 +12,13 @@ the tests, indicating why they're being skipped. ## Environmental Variables -The Perl 5's ecosystem is currently adhering to the +The Perl's ecosystem is currently adhering to the [environmental variables agreed upon as the Lancaster Consensus](https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts). This module is to implement those (thus bringing them into the Perl 6 world), as well as introduce a couple of extra ones. In the list below, `CPAN client` is to mean a module installation tool, -such as [`panda`](https://github.com/tadzik/panda/). The environmental variables +such as [`zef`](https://github.com/ugexe/zef/). The environmental variables to be supported by the module are: * **Lancaster Consensus** @@ -65,7 +65,7 @@ the tested environment will be the presence The module will not export any functions and all of its functionality will be used via the `use Test::When ...` line, for example: -```perl6 +```raku use Test::When , # env var settings :modules, # optional modules :libs; # needed C libs @@ -79,7 +79,7 @@ Keywords to be specified on the `use...` will correspond to the following sets of env vars that have to be set in order to run those tests. They are to be provided on the `use...` line as positional arguments, like so: -```perl6 +```raku use Test::When ; ``` @@ -107,7 +107,7 @@ are to be provided on the `use...` line as positional arguments, like so: Optional modules are to be specified as a list in `:modules` named argument: -```perl6 +```raku use Test::When :modules; ``` @@ -116,7 +116,7 @@ least one module is not installed. To specify particular versions, use pairs: -```perl6 +```raku use Test::When :modules( 'Extra::OptionalFeatures' => '1.001002' ); use Test::When :modules( 'Extra::OptionalFeatures' => (v6.a .. *) ); ``` @@ -124,11 +124,10 @@ To specify particular versions, use pairs: You can also use junctions to specify whether, say, you want any of the modules installed: -```perl6 +```raku use Test::When :modules( any ); ``` - ### Prerequisite C Libraries ![][spec-none] @@ -137,25 +136,23 @@ The needed C libraries are to be specified as a list in `:libs` named argument. Features and behaviour are same as [optional modules](#optional-modules). Version `v1` is to be assumed by default. -```perl6 +```raku use Test::When :libs; use Test::When :libs( sqlite3 => 'v2' ); use Test::When :libs( any ); ``` -## Feeback +## Feedback Results of feedback: * Change module name from `Test::Is` to `Test::When` -* OFFLINE_TESTING might be changed to ONLINE_TESTING, there's a poll running - https://twitter.com/zoffix/status/685108122227113984 * It's not uncommon to want any of X number of libraries/modules installed We need to support junctions in `:modules`/`:libs, e.g. `:lib('sqlite3', any() )` -* Use http://modules.perl6.org/repo/LibraryCheck for lib checking -* https://github.com/jonathanstowe/CheckSocket might also be useful for +* Use [LibraryCheck](https://raku.land/zef:jonathanstowe/LibraryCheck) for lib checking +* [CheckSocket](https://raku.land/zef:jonathanstowe/CheckSocket) might also be useful for something [spec-none]: _chromatin/spec-none.png diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..e513dd9 --- /dev/null +++ b/dist.ini @@ -0,0 +1,11 @@ +name = Test::When + +[ReadmeFromPod] +filename = doc/Test-When.rakudoc + +[UploadToZef] + +[Badges] +provider = github-actions/linux.yml +provider = github-actions/macos.yml +provider = github-actions/windows.yml diff --git a/doc/.Test-When.rakudoc.swp b/doc/.Test-When.rakudoc.swp new file mode 100644 index 0000000000000000000000000000000000000000..7f96a81aaa0deb285580e401b20709b084d86caf GIT binary patch literal 16384 zcmeI2O>87b6~}8gd_xE%>~aB7*-hBpXxw9aBOv4Pz+^nT8EIzhc*Ywx7gW<-<0;(J z-RZ9Oc$Nr6A{Iq_XahHPuY?04xxgX7EkS%-5E98I2T<5Wf(r+}L=Hsa|Ehc1W3O#Y z4hW>S{L^^G)%EeOSFh^To8Ih&MvFgS%`*JFkFnY7t@ZEz_3KB!cbPF)U7}C_?N4j2 zr95TzL!~cSJ%4Mz2R@Gqi|3Ud#Jyr|xz$>0H@X*#T^Z?_M+VX>I=;RA&I-jwj8FEf zEdM-LAXnh<3dFiU^NHKp+4(uM)K8wco8NWk+TowiOXdpX3gimp3gimp3gimp3gimp z3jE(Ipo63A3mC=GbR3+UH3=mG%w|4ID+_d6K-8~7vm1NbWV3iuqj1bRS#Pk|4B z-@li!o8VRO3ivVj5eUFN;5ax2j)EiL`P&(bKmi;D{r4~?!H2=C?`G@@_%gT*#$XG~ zfxEz+;O4s+y8(Uyeh$6^o&nduRnP(N2futLV=saiz|-IgcoIATJ_{6h7_5MEpbn0J zzr2I7KZDJxa16ZhcE+aCt5)Y9Ue*dC;n z4C6?1&)1WpTzF&d$W7_`!BBc=HslXilfo8L5g#enrLLhu>YX1X?WWb~fzW&?&_%H! zx!lsB;HHPDCX|sMhqjE^M2Y&RyY==`eQBc64k-qb$B_)F13~EHv4|SAZNr+OKaVNd0dkH${C)? zKY0K%h01A=ePJszoz!2`$hIM9h@-qn3)dB-zcCIz^qts6Q_;}hkm0t>)wS+&tJ>X1 z=RHiWH-<=D#M&PUEgdZ8ffUYJ-jc%T56hz-tjZ{mHVW{%x2ZzkBZCnxzaT;-dM+lK znPDXoSd6|9WfZ|oknN1{-6$xr+-^47+d9*P*UHsqGqVaVy-mI;LatEbqJ$i_??}dA z9-QhdmFQbmyzG0hOj%h#p`KhC?`6NMoMg$NBP_@97YFW5mYs($`)+)Aw3=+iOtkz5PX^iHVdwcJ znMyQ7QzDgTm=9%c@&CpLXrN+d8Wg4+XWZ$vD6w!kAXE^trkksoesKZ$i( zp!qTzKN>a%Iy&Md=Ls4^1UtlprPhMusxd=8!dI|qQM)*Az&B2+q|>H3!kJ0Q937n- zGecaecWSGRm2P9X%@`WROm& zg^F3@j?_ZA#@~$44Rl*#7bztjk1FPriT5x}yurHBp)yBw#aIYqf5NVsUtg_2gl(C^`GXaB7Z1r`1@3W=IwMjdJIQLd6o~y_=^YY zIBK3*U?`vVuUx02d8u?x3LT?&oVWZ?mP*U!I3HCCw;Zn0EuT(>bc&&E?7&0T9PeCg zFRyeO9k_lBKRu+)@Xlls$=cw!&8+V<&?z%FI%X?6wF_v7Lm&-3)2dx1h zj)B)v|3AP>;Md?e@GLk7>Yxl30QKWTApgk~$Q8&H$Q8&H$Q8&H$Q8&H$QAf6D{zu; zs$mIt3jqQNEqX|qsJLZHQxMgq<=TgX94K<1?n>Uq>+XBhwtyzn)njefqwLZ{% zes+GA&(O>Ld=Aig-JVhic0!7grnSAL{aI zdxCWoc$*cBmD5i(s`k{B%TlGr>o) zM;A7v)OO;Bf41vEW?9%9Vx4ZuP6xrTfSb);frs>$ z)V6hIlHQ|~&?IX_*%5OYWHAb + +use Test::When , + :modules, + :libs( 'someClib', any() ); + +=end code + +=head1 UNIMPLEMENTED / SPEC + +The C<:modules> and C<:libs> restrictions aren't yet implemented, but will +be soon. Checkout the L for details on what +they will do. + +=head1 DESCRIPTION + +This module lets you write selective tests that will only run when user +requested, say, network tests to run, or when the runner of the tests +explicitly requested any interactive tests to be avoided. These checks +are heavily based on the decisions by the +L. + +*Currently unimplemented.* The module also allows run tests only when a +specific module or C library are installed. This is handy when your +module offers extra optional functionality dependent on extra stuff, for +example. + +=head1 USAGE + +The type of tests your test file represents is specified on the C +line of C module. + +=head2 Environmental Variable Controlled Tests + +=begin code :lang + +use Test::When ; + +=end code + +The type of test environment to look for is set by positional arguments +provided on the C line. Multiple positional arguments can be +combined. Whether your tests run depends on the set environmental +variables. + +The following positional arguments are supported: + +=head3 smoke + +=begin code :lang + +use Test::When ; + +=end code + +Tests to run when either C or C env +vars are true. + +=head3 interactive + +=begin code :lang + +use Test::When ; + +=end code + +Tests must B be run when C is set to true, +unless C is also set to true. + +=head3 extended + +=begin code :lang + +use Test::When ; + +=end code + +Tests to be run when either C, C, +or C env var is set to true. + +=head3 release + +=begin code :lang + +use Test::When ; + +=end code + +Tests to be run when C or C env var is +set to true. + +=head3 author + +=begin code :lang + +use Test::When ; + +=end code + +Tests to be run when C or C env var is +set to true. + +=head3 online + +=begin code :lang + +use Test::When ; + +=end code + +Tests to be run when C or C env var is +set to true. + +=head3 Meaning of the Respected Environmental Variables + +=item C: if true, tests are being run by an automated +testing facility and not as part of the installation of a module; smokers +must set this to true; clients (e.g. C) must not set this. + +=item C: if true, tests should not attempt to +interact with a user; output may not be seen and prompts will not be +answered. + +=item C: if true, the user or process running tests +is willing to run optional tests that may take extra time or resources +to complete. Such tests must not include any development or QA tests. +Only tests of runtime functionality should be included. + +=item C: if true, tests are being run as part of a +release QA process; clients must not set this variable. + +=item C: if true, tests are being run as part of an +author's personal development process; such tests may or may not be +run prior to release. clients must not set this variable. Distribution +packagers (ppm, deb, rpm, etc.) should not set this variable. + +=item C: unless true, tests must not attempt to +access a network resource (such a website or attempt to query a +network interface). + +=item C: if true, all possible tests will be run. That +is, this module will NOT skip any tests it could possibly skip under +other environment. This B tests that require a particular +module or C library to be installed. + +=head1 AUTHOR + +Zoffix Znet + +=head1 COPYRIGHT AND LICENSE + +Copyright 2016 - 2017 Zoffix Znet + +Copyright 2020 - 2024 Raku Community + +This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. + +=end pod + +# vim: expandtab shiftwidth=4 diff --git a/lib/Test/When.pm6 b/lib/Test/When.rakumod similarity index 97% rename from lib/Test/When.pm6 rename to lib/Test/When.rakumod index 8d957df..3135b90 100644 --- a/lib/Test/When.pm6 +++ b/lib/Test/When.rakumod @@ -39,3 +39,5 @@ sub skip-all (Str $message) { say "1..0 # SKIPPING test: $message"; exit 0; } + +# vim: expandtab shiftwidth=4 diff --git a/run-tests b/run-tests new file mode 100644 index 0000000..565dcf5 --- /dev/null +++ b/run-tests @@ -0,0 +1,66 @@ +unit sub MAIN(:a($author), :i($install)); + +say run(, :out).out.slurp.chomp; +say "Running on $*DISTRO.gist().\n"; + +say "Testing { + "dist.ini".IO.lines.head.substr(7) +}{ + " including author tests" if $author +}"; + +my @failed; +my $done = 0; + +sub process($proc, $filename) { + if $proc { + $proc.out.slurp; + } + else { + @failed.push($filename); + if $proc.out.slurp -> $stdout { + my @lines = $stdout.lines; + with @lines.first( + *.starts-with(" from gen/moar/stage2"),:k) + -> $index { + say @lines[^$index].join("\n"); + } + else { + say $stdout; + } + } + else { + say "No output received, exit-code $proc.exitcode() ($proc.signal()):\n$proc.os-error()"; + } + } +} + +sub install() { + my $zef := $*DISTRO.is-win ?? 'zef.bat' !! 'zef'; + my $proc := run $zef, "install", ".", "--verbose", "--/test", :out,:err,:merge; + process($proc, "*installation*"); +} + +sub test-dir($dir) { + for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort { + say "=== $_"; + my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge; + process($proc, $_); + $done++; + } +} + +test-dir("t"); +test-dir($_) for dir("t", :test({ !.starts-with(".") && "t/$_".IO.d})).map(*.Str).sort; +test-dir("xt") if $author && "xt".IO.e; +install if $install; + +if @failed { + say "\nFAILED: {+@failed} of $done:"; + say " $_" for @failed; + exit +@failed; +} + +say "\nALL {"$done " if $done > 1}OK"; + +# vim: expandtab shiftwidth=4 diff --git a/t/00-use.t b/t/00-use.rakutest similarity index 100% rename from t/00-use.t rename to t/00-use.rakutest diff --git a/t/01-env-vars.t b/t/01-env-vars.rakutest similarity index 99% rename from t/01-env-vars.t rename to t/01-env-vars.rakutest index 48a772f..3a7f79f 100644 --- a/t/01-env-vars.t +++ b/t/01-env-vars.rakutest @@ -1,4 +1,3 @@ -use lib ; use Test; plan 8; @@ -138,8 +137,6 @@ subtest { "with ALL_TESTING"; }, 'running with invalid keyword for testing'; -done-testing; - sub run-test (Str:D $test, *%vars) { # set unused env vars to zero, so the tests of this module are not # affected by possible env options set for other modules @@ -161,3 +158,5 @@ sub run-test (Str:D $test, *%vars) { return $out unless $err; return "$out STDERR: $err"; } + +# vim: expandtab shiftwidth=4