GithubHelp home page GithubHelp logo

raku / roast Goto Github PK

View Code? Open in Web Editor NEW
177.0 140.0 135.0 35.16 MB

🦋 Raku test suite

Home Page: https://raku.org/

License: Artistic License 2.0

Perl 1.36% Roff 0.01% Raku 98.62% Turing 0.01%
raku hacktoberfest

roast's Introduction

The Official Raku Test Suite

The purpose of the test suite is to validate implementations that wish to be known as a conforming Raku.

Contents

Introduction

Please consider this test suite to be the bleeding edge of Raku development. New tests, tests for proposed new features, etc., will live on this 'master' branch. Once a specification is cut, a tag will be created for that version of the spec, e.g., 6.c for Christmas language release. If errata become available, they will be kept in an -errata branch for that specific language version, e.g. 6.c-errata for 6.c.

As they develop, different implementations will certainly be in different states of readiness with respect to the test suite, so in order for the various implementations to track their progress independently, we've established a mechanism for fudging the tests in a kind of failsoft fashion. To pass a test officially, an implementation must be able to run a test file unmodified, but an implementation may (temporarily) skip tests or mark them as "todo" via the fudging mechanism, which is implemented via the fudge preprocessor. Individual implementations are not allowed to modify the actual test code, but may insert line comments before each actual test (or block of tests) that changes how those tests are to be treated for this platform. The fudge preprocessor pays attention only to the comments that belong to the current implementation and ignores all the rest. If your implementation is named "rakudo" then your special comment lines look like:

#?rakudo: [NUM] VERB ARGS

(The colon is optional.)

The optional NUM says how many statements or blocks to apply the verb to. (If not supplied, a value of 1 is assumed). A statement is arbitrarily defined as one or more lines starting with a test call and ending in a semicolon (with an optional comment).

VERBs include:

skip "reason"	# skip test entirely
eval "reason"	# eval the test because it doesn't parse yet
try "reason"	# try the test because it throws exception
todo "reason"	# mark "todo" because "not ok" is expected
emit code		# insert code (such as "skip-rest();") inline

All fudged tests return an exit code of 1 by default, so the test harness will mark it as "dubious" even if all the tests supposedly pass.

You may also negate the test:

#!rakudo [NUM] VERB ARGS

This will apply the verb on any system that isn't rakudo.

Sometimes environment variables distinguish syntactic or semantic variants, so you may apply a verb depending on the presence or absence of such a setting:

#?MYSPECIALVAR [NUM] VERB ARGS
#!MYSPECIALVAR [NUM] VERB ARGS

The environment variable must be uppercase.

There is also the following directive which modifies the test count of the next construct:

#?DOES count

The count may be an expression as long as any variables referenced in the expression are in scope at the location fudge eventually inserts a "skip()" call.

When applied to a subsequent sub definition, fudge registers the sub name as doing that many tests when called. Note, however, that any skipping is done at the point of the call, not within the subroutine, so the count may not refer to any parameter of the sub.

When you run the fudge preprocessor, if it decides the test needs fudging, it returns the new fudged filename; otherwise it returns the original filename. (Generally you don't run fudge directly, but your test harness runs the fudgeall program for you; see below.) If there is already a fudged program in the directory that is newer than the unfudged version, fudge just returns the fudged version without regenerating it. If the fudged version is older, it removes it and then decides anew whether to regenerate it based on the internal fudge comments.

The fudgeall program may be called to process all the needed fudging for a particular implementation:

$ fudgeall rakudo */*.t */*/*.t

Program fudgeall will use the fudge program to translate any fudged files to a new file where the extension is not *.t but instead is *.rakudo to indicate the implementation dependency. It also returns the fudged list of filenames to run, where unfudged tests are just passed through unchanged as *.t. Each test comes through as either fudged or not, but never both. The test harness then runs the selected test files as it normally would (it shouldn't care whether they are named *.t or *.rakudo).

In cases where the current working directory makes a difference, the tests assume that the working directory is the root of the test suite, so that the relative path to itself is t/spec/S\d\d-$section/$filename.

To fudge and run prove on a specific file:

./fudgeandrun S05-metasyntax/angle-brackets.t

fudgeandrun does not assume any particular implementation but guesses by running perl6 to look at special variables like $*PERL. See fudgeandrun usage to specify a different implementation and other options.

Test Utilities

This repository contains Test::Util module with helper routines you can use when writing tests. See POD documentation included at the end of the module's source code. To include the module, in your test file, you need to add use lib line to your test file.

use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers';
use Test::Util;
use Test;

Depending on the location of your test file, the number inside .parent(2) may need to be adjusted to go up the correct number of times from the test files's location to the root of the repository.

Appendices

The APPENDICES directory contains advisory tests implentations may optionally choose to follow. See the README included in that directory for more information.

APPENDICES are not included in released versions of the specification.

Environmental Variables

  • ROAST_TIMING_SCALE

Some tests rely on a process to complete in a certain amount of time. If you're running on a slowish computer, try setting ROAST_TIMING_SCALE to a larger value that will be used as a multiplier for the time to wait. We don't wait for too long a time by default so as to make the roast run faster. Defaults to 1.

Contributing

See CONTRIBUTING.md

roast's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roast's Issues

test fails for t/04-nativecall/16-rt125408.t

Installing rakudo perl6 with moar

make test
...
t/04-nativecall/15-rw-args.t ......... ok     
t/04-nativecall/16-rt125408.t ........ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 
t/04-nativecall/16-rt125729.t ........ ok   
...

More verbose (prove6 is an alias)

prove6 -v t/04-nativecall/16-rt125408.t 
t/04-nativecall/16-rt125408.t .. Unhandled exception: Missing or wrong version of dependency 'gen/moar/stage2/QRegex.nqp' (from 'src/gen/m-main.nqp')
   at <unknown>:1  (/home/marcel/Software/lib/perl6/share/perl6/runtime/perl6.moarvm:<dependencies+deserialize>:73)
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run 

Test Summary Report
-------------------
t/04-nativecall/16-rt125408.t (Wstat: 256 Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.02 cusr  0.00 csys =  0.05 CPU)
Result: FAIL

Version is

./perl6-m -v
This is perl6 version 2015.07.1-182-g5ba44fc built on MoarVM version 2015.07-108-g7e9f29e

OS is

uname -a
Linux h03-fedora 4.1.5-100.fc21.x86_64 #1 SMP Tue Aug 11 00:24:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

testing negative exponentials

Reading through s02 section Exponentials, I found a number representation which I tried in perl6.
Result is

> :10<1*2**-64>
===SORRY!=== Error while compiling <unknown file>
Malformed radix number
at <unknown file>:1
------> :10<1*2**⏏-64>
    expecting any of:
        number in radix notation

It seems not to accept the minus sign. It will accept positive numbers.
This is not tested in 'S02-literals/radix.t lines 183–192'.

Version of perl;
This is perl6 version 2015.01-77-gd320f00 built on MoarVM version 2015.01-21-g4ee4925

uniprop needs tests for all unicode properties

Emoji:

See: http://unicode.org/reports/tr51/#Data_Files for how they are determined (These are Boolean)
Values stored here: http://unicode.org/Public/emoji/latest/emoji-data.txt
If you hadn't seen this before, really great resource to check which symbols have a property:

http://unicode.org/cldr/utility/properties.html

  • Emoji
  • Emoji_Presentation
  • Emoji_Modifier
  • Emoji_Modifier_Base
  • Emoji_All

Emoji_Zwj_Sequences is a property of multiple codepoints together (we may need another routine to do this since it is a property of sequences of codepoints).

  • Emoji_Zwj_Sequences

Numeric Properties

  • cjkAccountingNumeric ; kAccountingNumeric
  • cjkOtherNumeric ; kOtherNumeric
  • cjkPrimaryNumeric ; kPrimaryNumeric
  • nv ; Numeric_Value

String Properties

  • cf ; Case_Folding
  • cjkCompatibilityVariant ; kCompatibilityVariant
  • dm ; Decomposition_Mapping
  • FC_NFKC ; FC_NFKC_Closure
  • lc ; Lowercase_Mapping
  • NFKC_CF ; NFKC_Casefold
  • scf ; Simple_Case_Folding ; sfc
  • slc ; Simple_Lowercase_Mapping
  • stc ; Simple_Titlecase_Mapping
  • suc ; Simple_Uppercase_Mapping
  • tc ; Titlecase_Mapping
  • uc ; Uppercase_Mapping

Miscellaneous Properties

  • bmg ; Bidi_Mirroring_Glyph
  • bpb ; Bidi_Paired_Bracket
  • cjkIICore ; kIICore
  • cjkIRG_GSource ; kIRG_GSource
  • cjkIRG_HSource ; kIRG_HSource
  • cjkIRG_JSource ; kIRG_JSource
  • cjkIRG_KPSource ; kIRG_KPSource
  • cjkIRG_KSource ; kIRG_KSource
  • cjkIRG_MSource ; kIRG_MSource
  • cjkIRG_TSource ; kIRG_TSource
  • cjkIRG_USource ; kIRG_USource
  • cjkIRG_VSource ; kIRG_VSource
  • cjkRSUnicode ; kRSUnicode ; Unicode_Radical_Stroke; URS
  • isc ; ISO_Comment
  • JSN ; Jamo_Short_Name
  • na ; Name
  • na1 ; Unicode_1_Name

Name_Alias and Script_Extensions can hold multiple values. It is not yet determined how we will access them once they are added to some backend

  • Name_Alias ; Name_Alias
  • scx ; Script_Extensions

Catalog Properties

  • age ; Age
  • blk ; Block
  • sc ; Script

Enumerated Properties

  • bc ; Bidi_Class
  • bpt ; Bidi_Paired_Bracket_Type
  • ccc ; Canonical_Combining_Class
  • dt ; Decomposition_Type
  • ea ; East_Asian_Width
  • gc ; General_Category
  • GCB ; Grapheme_Cluster_Break
  • hst ; Hangul_Syllable_Type
  • InPC ; Indic_Positional_Category
  • InSC ; Indic_Syllabic_Category
  • jg ; Joining_Group
  • jt ; Joining_Type
  • lb ; Line_Break
  • NFC_QC ; NFC_Quick_Check
  • NFD_QC ; NFD_Quick_Check
  • NFKC_QC ; NFKC_Quick_Check
  • NFKD_QC ; NFKD_Quick_Check
  • nt ; Numeric_Type
  • SB ; Sentence_Break
  • WB ; Word_Break

Binary Properties

  • AHex ; ASCII_Hex_Digit
  • Alpha ; Alphabetic
  • Bidi_C ; Bidi_Control
  • Bidi_M ; Bidi_Mirrored
  • Cased ; Cased
  • CE ; Composition_Exclusion
  • CI ; Case_Ignorable
  • Comp_Ex ; Full_Composition_Exclusion
  • CWCF ; Changes_When_Casefolded
  • CWCM ; Changes_When_Casemapped
  • CWKCF ; Changes_When_NFKC_Casefolded
  • CWL ; Changes_When_Lowercased
  • CWT ; Changes_When_Titlecased
  • CWU ; Changes_When_Uppercased
  • Dash ; Dash
  • Dep ; Deprecated
  • DI ; Default_Ignorable_Code_Point
  • Dia ; Diacritic
  • Ext ; Extender
  • Gr_Base ; Grapheme_Base
  • Gr_Ext ; Grapheme_Extend
  • Gr_Link ; Grapheme_Link
  • Hex ; Hex_Digit
  • Hyphen ; Hyphen
  • IDC ; ID_Continue
  • Ideo ; Ideographic
  • IDS ; ID_Start
  • IDSB ; IDS_Binary_Operator
  • IDST ; IDS_Trinary_Operator
  • Join_C ; Join_Control
  • LOE ; Logical_Order_Exception
  • Lower ; Lowercase
  • Math ; Math
  • NChar ; Noncharacter_Code_Point
  • OAlpha ; Other_Alphabetic
  • ODI ; Other_Default_Ignorable_Code_Point
  • OGr_Ext ; Other_Grapheme_Extend
  • OIDC ; Other_ID_Continue
  • OIDS ; Other_ID_Start
  • OLower ; Other_Lowercase
  • OMath ; Other_Math
  • OUpper ; Other_Uppercase
  • Pat_Syn ; Pattern_Syntax
  • Pat_WS ; Pattern_White_Space
  • PCM ; Prepended_Concatenation_Mark
  • QMark ; Quotation_Mark
  • Radical ; Radical
  • SD ; Soft_Dotted
  • STerm ; Sentence_Terminal
  • Term ; Terminal_Punctuation
  • UIdeo ; Unified_Ideograph
  • Upper ; Uppercase
  • VS ; Variation_Selector
  • WSpace ; White_Space ; space
  • XIDC ; XID_Continue
  • XIDS ; XID_Start
  • XO_NFC ; Expands_On_NFC
  • XO_NFD ; Expands_On_NFD
  • XO_NFKC ; Expands_On_NFKC
  • XO_NFKD ; Expands_On_NFKD

Total: 118 + 6 Emoji

Implementation specific properties

These are not official Unicode properties and should not have tests written for them. They are listed here for completeness.

  • MVM_COLLATION_PRIMARY
  • MVM_COLLATION_SECONDARY
  • MVM_COLLATION_TERTIARY
  • MVM_COLLATION_QC
  • Numeric_Value_Numerator
  • Numeric_Value_Denominator
  • NFG_QC

Add test for reduce with one item

[15:17] <quietfanatic> p6: say (reduce *+*, 1, 2).WHAT
[15:17] <+camelia> rakudo-moar af886d: OUTPUT«(Int)␤»
[15:17] <quietfanatic> p6: say (reduce *+*, 1).WHAT
[15:17] <+camelia> rakudo-moar af886d: OUTPUT«(List)␤»
[15:17] <quietfanatic> Hah.  If that isn't a reportable bug, I don't know what is.

I expect reduce with one item to return that item, but it wraps it in a List instead.

This should test for that.
is-deeply(reduce(+, 72), 72, "reduce with one item returns that item")

Test for some context issue

When trying some older camelia queries I found this:

Code:

sub plop { loop (my int $i = 0; $i < 10; ++$i) { say $i }; }; plop();

Result (2015.12):

No lexical found with name '$i'
in block <unit> at /tmp/sNWgnSu4JV line 1

Result (HEAD):

0
1
2
3
4
5
6
7
8
9

Bisectable says that it was fixed in rakudo/rakudo@37e742f

I wonder if there's any test for this. If not, then we should probably add one.

define meaning of <prior> in S05

Originally opened as https://rt.perl.org/rt3/Ticket/Display.html?id=58290

Subject:    <prior> not implemented in rules in Rakudo
Date:   Sat, 23 Aug 2008 11:26:49 +0200
To: [email protected]
From:   "Carl M?sak" <[email protected]>
To match whatever the prior successful regex matched, use:

/ <prior> /

r30466:
$ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ /ll/' # works
ll
ll
$ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ / <prior> /'
# not implemented
ll
Unable to find regex 'prior'
Null PMC access in invoke()
[...]

This feature request is perhaps more accurately classified as
pertaining to PGE. Please re-tag as needed.

Subject:    Re: [perl #58290] <prior> not implemented in rules in Rakudo
Date:   Sat, 23 Aug 2008 08:16:43 -0500
To: [email protected]
From:   "Patrick R. Michaud" <[email protected]>
On Sat, Aug 23, 2008 at 02:27:10AM -0700, Carl M?sak wrote:
> To match whatever the prior successful regex matched, use:
> 
> / <prior> /
> 
> r30466:
> $ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ /ll/' # works
> ll
> ll
> $ ./perl6 -e 'my $s = "hello"; say $s ~~ /ll/; say $s ~~ / <prior> /'
> # not implemented
> ll
> Unable to find regex 'prior'
> Null PMC access in invoke()
> [...]
> 
> This feature request is perhaps more accurately classified as
> pertaining to PGE. Please re-tag as needed.

...correct -- C<< <prior> >> is not yet implemented. I'm not
certain if it belongs in PGE or in Rakudo... I'm guessing that
<prior> needs to refer to the "prior successful regex" in a
statement-level context, as opposed to a regex context. For
example, if we interpret S05 literally then in the regex

/ <foo> <prior> /

it's pretty clear that C<< <foo> >> is the prior successful regex 
matched, and I think that's not what is intended by C<< <prior> >>.
(If it is what is intended, then C<< <prior> >> becomes much
simpler. :-)

Pm

RT-Send-CC: [email protected]

I've changed this ticket to indicate that it's waiting on spec
clarification as to the exact meaning of <prior> in regexes.

Pm

Tests for superscript autocurrying

Maybe there are some already. But if not, consider adding something like this:

<AlexDaniel> m: say [+] (3..9).map: *³
<camelia> rakudo-moar ea67ce: OUTPUT«2016␤»

<AlexDaniel> bisect: say [+] (3..9).map: *³
<bisectable6> AlexDaniel, Bisecting by exit code (old=2015.12 new=ea67ce9). Old exit code: 1
<bisectable6> AlexDaniel, bisect log: https://gist.github.com/2118bb6a99db2b8486a7f3776da3ab9b
<bisectable6> AlexDaniel, (2016-12-16) https://github.com/rakudo/rakudo/commit/c35d562df19d1351c8ea38bfa7027c8ea2092b75

<AlexDaniel> commit: c35d562df1^,c35d562df1 say [+] (3..9).map: *³
<committable6> AlexDaniel, ¦«c35d562df1^»: Cannot resolve caller Numeric(Whatever: ); none of these signatures match:␤    (Mu:U \v: *%_)␤  in block <unit> at /tmp/YswXNqpQVd line 1␤ «exit code = 1»␤¦«c35d562»: 2016

using previously defined names as values in enumerations

The C programming language allows enumeration constants like this one:

enum { foo, bar = foo };

In Perl 6, that would correspond to:

enum ("foo", bar => foo);

Currently, such code dies like this:

===SORRY!=== Error while compiling -e
Undeclared routine:
    foo used at line 1

I did not see it tested anywhere in S12-enum/, which means either that I failed to find it, that Perl 6 is not meant to behave as C in that regard, or that it was involuntary omitted.

The second case would be LTA imho. I stumbled upon such kind of enum while looking at a header file for the Vulkan 3D graphics API. I don't look at C header files very often so the fact that I've seen this construction suggests that they are not very rare. I believe Perl 6's enumeration constants should behave similarly as their C counterparts, since that would help the translation of C header files for NativeCall bindings.

Test args of Array.splice Callable candidates

Commit 0892f24 tests all the candidates of Array.splice, but never bothers to check the arguments received by Callable params are correct. The offset Callables receive the .elems of the Array being spliced and size Callables receive the size of the piece past offset (that is .elems - offset)

order of permutations

permutations.t priviledges a particular order. That prevents the use of a possibly more efficient algorithm returning its results in a different order.

I suggest sorting the output before comparing it.

is (1, 2, 3).permutations.list.sort(:by(*.join)).perl, ((1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)).perl, "permutations method";
is permutations(3).list.sort(:by(*.join)).perl, ((0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)).perl, "permutations function";

As mentioned this would allow other algorithm such as this one (notice the credits, the author gave me autorisation via email):

sub permutations(int $n) {
    # Credits for the following code goes to Phillip Paul Fuchs,
    # who authorized its use here in november 2015.
    # See his website, L<http://www.quickperm.org/>,
    # for more information.
    Seq.new:
        class :: does Iterator {
        has int $!n;
        has     @!a;
        has int $!i;
        has     @!p;
        submethod BUILD(:$n) { $!n = $n; self }
        method pull-one {
            if !@!a { @!a = ^$!n; $!i = 1; @!p = 0 .. $n; @!a; }
            elsif $!i < $!n {
                @!p[$!i]--;
                @!a[$!i !%% 2 ?? @!p[$!i] !! 0, $!i].=reverse;
                $!i = 0;
                @!p[$!i] = $!i while @!p[++$!i] == 0;
                @!a;
            }
            else { IterationEnd }
         }
        method count-only { [*] 1..$!n }
    }.new(:$n)
}

From my experiments, it seems to me that this algorithm is about twice as fast.

.perl for self-referent structures

Pulled from https://rt.perl.org/rt3/Ticket/Display.html?id=58922

Subject:        .perl for self-referent structures
Date:   Tue, 16 Sep 2008 17:17:27 +0200
To:     [email protected]
From:   "Carl M�sak" <[email protected]>
Download (untitled) [text/plain 631b]
Calling .perl on a self-referent structure makes Rakudo r31152 hang.

$ ./perl6 -e 'my @a = (1); @a[0] := @a; @a.perl'

<masak> pmichaud: what about @a[0] := @a ?
<pmichaud> masak: I don't know about that one. :-)
[...]
<masak> :)
[...]
<pmichaud> part of me thinks that ends up with a self-referential structure
<masak> I hope so
<masak> that seems to be what's happening in at least one case in
Rakudo right now
<masak> question is, should .perl be able to handle that, and if so, how?
<moritz_> masak: it should
<moritz_> perhaps it should emit something like 'do { my @x = (...);
@x[0] := @x; @x }'
* masak submits rakudobug

#       Fri Nov 07 15:01:43 2008         pmichaud - Correspondence added                 [Reply] [Comment]
RT-Send-CC:     [email protected]
Download (untitled) [text/plain 193b]
I'm going to mark this ticket as stalled until we have a good idea of
how self-referent structures should be handled in the output, either
through the spec itself or the spectests.

Thanks!

Pm

List as RHS to smartmatch is undertested

The problem is with this piece of code (from https://github.com/rakudo/rakudo/blob/nom/src/core/List.pm#L426):

        unless nqp::istype($topic, Iterable) {
            return self unless self.elems;
            return self if nqp::istype(self[0], Match);
            return False;
        }

For example:

say 4 ~~ ()           # ()

↑ That is a bit unexpected.
Some tests would help to clarify what should actually happen in these cases.

Also see http://irclog.perlgeek.de/perl6/2016-04-24#i_12386065 (discussion afterwards).

I've also opened this ticket: https://rt.perl.org/Ticket/Display.html?id=127980

Fudge tests instructions

The docs on fudging, IMHO, need to be written using "rakudo" as an example instead of "humpty", even though the test suites I guess can be used for other implementations--less confusing for wannabee contributors to rakudo. A wee bit more cookbook approach would also be useful.

I'll be glad to take a stab it unless this issue is deemed unnecessary.

no tests for sub cross

Alias to infix: defined in src/core/List.pm. Likely just an oversight, still at least a test for existence is required.

.duckmap/.deepmap are entirely untested.

See http://irclog.perlgeek.de/perl6-dev/2016-09-27#i_13295357

There's a passing mention in S03-metaops/hyper.t to test them for nodalness, but the functionality itself isn't tested.


Hacktoberfest participants:

The behaviour can be found from sourcecode here and here. the docs here and here, or you can join our IRC channels and ask for clarifications #perl6 or #perl6-dev.

Create new test files: S32-list/duckmap.t (might already exist) and S32-list/deepmap.t. Copy over one of the existing files in that directory to use as a starting template. Use any of the available testing routines to thoroughly test all of the behaviour and then submit the PR.

Once done and the PR is merged, if you did create new files, you can also submit another PR to add them to Rakudo's test list; just add your file where it fits alphabetically.

Windows Stresstest Failures

Filing this for records. Some of these are likely due to poorly constructed tests. Will try to look at them...

On today's HEAD, I get the following stresstest failures when run on Windows 10. I've not yet checked if any of these are simply floppers that pass when run on their own....

  • t\spec\S02-literals\quoting.t (Wstat: 256 Tests: 189 Failed: 1)
    Failed test: 126
    Non-zero exit status: 1
  • t\spec\S02-types\num.rakudo.moar (Wstat: 512 Tests: 98 Failed: 2)
    Failed tests: 86, 88
    Non-zero exit status: 2
  • t\spec\S10-packages\precompilation.rakudo.moar (Wstat: 1024 Tests: 51 Failed: 4)
    Failed tests: 45-48
    Non-zero exit status: 4
  • t\spec\S16-filehandles\filetest.rakudo.moar (Wstat: 65280 Tests: 43 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 44 tests but ran 43.
  • t\spec\S17-procasync\basic.rakudo.moar (Wstat: 256 Tests: 34 Failed: 1)
    Failed test: 33
    Non-zero exit status: 1
  • t\spec\S17-procasync\encoding.t (Wstat: 65280 Tests: 0 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 13 tests but ran 0.
  • t\spec\S17-procasync\kill.rakudo.moar (Wstat: 65280 Tests: 6 Failed: 1)
    Failed test: 2
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 9 tests but ran 6.
  • t\spec\S17-procasync\stress.t (Wstat: 65280 Tests: 0 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 12 tests but ran 0.
  • t\spec\S17-supply\interval.t (Wstat: 768 Tests: 8 Failed: 3)
    Failed tests: 5-7
    Non-zero exit status: 3
  • t\spec\S19-command-line\dash-e.t (Wstat: 256 Tests: 4 Failed: 1)
    Failed test: 2
    Non-zero exit status: 1
  • t\spec\S19-command-line\repl.rakudo.moar (Wstat: 65280 Tests: 0 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 12 tests but ran 0.
  • t\spec\S22-package-format\local.t (Wstat: 256 Tests: 19 Failed: 1)
    Failed test: 7
    Non-zero exit status: 1
  • t\spec\S29-os\system.rakudo.moar (Wstat: 65280 Tests: 32 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 35 tests but ran 32.
  • t\spec\S32-io\pipe.t (Wstat: 65280 Tests: 10 Failed: 0)
    Non-zero exit status: 255
    Parse errors: Bad plan. You planned 14 tests but ran 10.
  • t\spec\S32-list\pick.t (Wstat: 62464 Tests: 316 Failed: 244)
    Failed tests: 73-316
    Non-zero exit status: 244
    Files=1191, Tests=130210, 1664 wallclock secs (11.45 usr + 1.75 sys = 13.20 CPU)
    Result: FAIL
    makefile:525: recipe for target 'm-stresstest5' failed
    gmake: *** [m-stresstest5] Error 1

.trans order should be defined

Code:

say abc.trans(a => X, a => Z, c => C)

Result (2015.12):

XbC

Result (2016.02,HEAD):

ZbC

Need more S/// tests

Based on grep of the repo, we have a rather scanty collection of S/// rests. We need more, especially tests with adverbs.

cpan@perlbuild2~/CPANPRC/rakudo/t/spec (master)$ grep -FR 'S/' .
./S03-operators/andthen.rakudo.moar:todo('RT 127822'); is (S/a/A/ andthen S/b/B/ given "ab"), "AB", 'andthen with two S///';
./S03-operators/andthen.t:is (S/a/A/ andthen S/b/B/ given "ab"), "AB", 'andthen with two S///';
./S05-substitution/subst.rakudo.moar:    is S/a/A/, "foo", "non-mutating single substitution works ($/)";
./S05-substitution/subst.rakudo.moar:    is S/o/O/, "fOo", "non-mutating single substitution works ($/)";
./S05-substitution/subst.rakudo.moar:    is S/(o)/{$0.uc}/, "fOo", "non-mutating single substitution works ($0)";
./S05-substitution/subst.rakudo.moar:    is_run 'await ^30 .map: { start { S/.+/{$/.chars.print}/ given "abc"; } }', {
./S05-substitution/subst.t:    is S/a/A/, "foo", "non-mutating single substitution works ($/)";
./S05-substitution/subst.t:    is S/o/O/, "fOo", "non-mutating single substitution works ($/)";
./S05-substitution/subst.t:    is S/(o)/{$0.uc}/, "fOo", "non-mutating single substitution works ($0)";
./S05-substitution/subst.t:    is_run 'await ^30 .map: { start { S/.+/{$/.chars.print}/ given "abc"; } }', {

UInt is not tested

I'm not sure if that's the right place to report that (why there are no “is not tested” issues here?).

It looks like there are no tests for UInt.

Tie-breaking rule between where-blocked multi and non-where-blocked multi is not specced

I can find the tie-breaking rule between where-blocked multi routines in roast.
https://github.com/perl6/roast/blob/master/S06-multi/subsignature.t#L431-L441

However, it seems that there is another tie-breaking rule that where-blocked multi has higher priority than non-where-blocked multi.

The following example shows the above mentioned rule.

$ perl6 -e 'multi foo(Int $a){ say "1st" }; multi foo(Int $a where *.so){ say "2nd" }; foo(-1)'
2nd
$ perl6 -e 'multi foo(Int $a where *.so){ say "1st" }; multi foo(Int $a){ say "2nd" }; foo(-1)'
1st

IO::Handle is undertested

Code:

say $*IN.path

Result:

IO::Special.new(what => "<STDIN>")

Looking at this snippet, it seems like $.path attribute is not tested. Also, there are no tests for IO::Special.

Tests needed for using method invocant to distinguish between class and object methods

class C {
    multi method f(::?CLASS:U:){say "class method"}
    multi method f(::?CLASS:D:){say "object method"}
}
C.f;       # says class method
C.new.f;   # says object method

I see some other invocant related tests but not for this use case that appears in S12, mentioned in docs, and seems well enough known.

moritz++ mentioned: a proposed addition that would let you write method f(:U:) { } for a class-only method...

A comment about the proposed addition might go in with the tests.

See also IRC discussion.

No test for generic object $a cmp $b

https://docs.perl6.org/language/operators#infix_cmp says:

if $a eqv $b, then $a cmp $b always returns Order::Same.

That makes sense and leads me to expect this should work, but it doesn't:

use Test;
class Point3D { has Int $.x; has Int $.y; has Int $.z; }
my $p1 = Point3D.new(:1x, :2y, :3z);
my $p2 = Point3D.new(:1x, :2y, :3z);
my $p3 = Point3D.new(:1x, :2y, :300z);
ok $p1 eqv $p2;
ok $p1 !eqv $p3;
is $p1 cmp $p2, Order::Same; # fail: actually returns Less
is $p1 cmp $p3, Order::Less;
is $p3 cmp $p1, Order::More;

I can get the third test to behave by adding:

multi infix:<cmp>($a, $b where $b eqv $a) { Order::Same }

Default encoding and default nl-in/nl-out values are probably undertested

  • Tests for nl-in seem to be in S16-io/lines.t, but I don't see anything that would test its default value.
  • One test for nl-out is in S29-any/deg-trans.t, arguably it tests the default value.
  • :enc is used everywhere, but I don't see anything that would test its default behavior.

There is a high chance that something actually tests it somewhere (probably implicitly), but I think we should have a couple of clear simple tests exactly for the purpose of testing the default values.

In some sense this ticket is a continuation of Raku/doc#1111.

rakudo doesn't guarantee how often FETCH is called for S12-attributes/mutators.t

Besides other RT #124909 issues, FETCH can get called more than once.

I am sorry but I don't know how to open the issue for just that test file.

use v6;

#`{{
The problem is that with an $.attr type of Int FETCH is called twice
for one access to $.attr.
If you take away the type of Int $f_count returns 1 and bug goes away

According to timotimo "rakudo doesn't guarantee how often FETCH is called"
http://irclog.perlgeek.de/perl6/2015-09-25#i_11276252
}}

use Test;

plan 1;

our $f_count = 0;

class C {
    has Int $.attr is rw;

    method attr returns Int is rw {
        return Proxy.new(
            FETCH => -> $self {$f_count++; 42 },
            STORE => -> $self, Int $new {},
        );
    }
}

my C $c .= new;
my $a = $c.attr;
is($f_count, 1, 'fetch called more than once can be unexpected');

Review S03-operators/shortcuts.t

This file was added in 2013, isn't in t/spectest.data, and fails to compile.

Need to review this file and run it or delete it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.