Permalink
Browse files

t/spec/ now lives in a separate repository

  • Loading branch information...
1 parent a536ac4 commit 06cd5194797771c1700c0df10189597184ba634a @moritz moritz committed Sep 4, 2010
Showing 817 changed files with 3 additions and 76,934 deletions.
View
164 t/README
@@ -13,164 +13,6 @@
Welcome to the Pugs Test suite.
-Pugs is currently being developed in a highly test-driven manner. Tests are
-written for both implemented and unimplemented features and are based roughly
-on the Perl6 Language Synopsis documents. All are welcome and encouraged to
-contribute to this test suite. The part under spec/ is considered to be the
-official Perl 6 test suite, and should only test what is specified in the
-Synopsis documents. It is also used by other Perl 6 implementations.
-
--------------------------------------------------------------------------------
-Getting Started
--------------------------------------------------------------------------------
-
-Here are some basic guidelines to help you get started writing tests for Pugs.
-
-- Prerequisites
-
-Please read the Perl 6 Spec first, namely, the Synopses:
-
- http://perlcabal.org/syn/
-
-or directly from the SVN repos:
-
- http://svn.pugscode.org/pugs/docs/Perl6/Spec/
-
-A good grasp of the Perl 6 language itself is very important to writing good
-tests.
-
-- If you are unsure of something, don't hesitate to ask.
-
-If you have a question about a test, written or unwritten, log on to #perl6 on
-irc.freenode.net or send an email to perl6-compiler and ask someone about it.
-If you have read the synopses very carefully and are still unsure about a
-perl6 language element, we encourage you to ask on #perl6 or email the
-perl6-language list and get clarification. Pugs and Perl 6 are group efforts
-and asking questions is a good thing.
-
-- What to test
-
-A number of Pugs hackers on #perl6 run regular smoke tests, and you can run
-your own using 'make smoke'. The smoke test produces an HTML graph of what tests
-are passing, and what aren't. This can be a good place to start. There's a smoke
-server on the web:
-
- http://m19s28.dyndns.org/cgi-bin/pugs-smokeserv.pl?
-
-There is also a cross linking which is made between the tests and the synopses.
-It's generated by running the 'util/smartlinks.pl' script. You
-can generate an HTML version of the latest Synopses cross-referenced with test
-file snippets from the test suite using the following command:
-
- $ util/smartlinks.pl t/*/*.t t/*/*/*.t
-
-There's a cross-referenced version of Synopses at
-
- http://perlcabal.org/syn/
-
-which is automatically updated by the smartlinks.pl script on feather once
-an hour.
-
-- Use the Test module.
-
-We have created a basic Test module found in ext/Test/lib/Test.pm. It is
-written in Perl 6 and implements the TAP protocol (and so can be used with
-Test::Harness). The module has its own documentation and I encourage you to
-read it.
-
-- Pugs tests should have a non-she-bang line of "use v6;".
-
-This line helps both Test::Harness as well as the 'prove6' utility when
-running Pugs tests.
-
-- Place tests in the appropriate folder.
-
-We have recently undergone a re-organization of the test suite in order to
-make it easier to find what has and has not been tested. It is important as
-the test suite grows that we try to keep this organization. If you have a test
-and are unsure of where to put it, ask on #perl6 for help, or put it in the
-general/ folder and email perl6-compiler and let us know.
-
-Tests that belong to one synopsis document should go under
-t/spec/SXX-SECTION/, where XX is the number of the synopsis and SECTION is the
-title (or an important key word of the title) under which the tested behaviour
-is described.
-
-Warning: please grep the whole test suite to ensure the tests you want to add
-are not already in some file.
-
-- Run the test file with util/prove6 to test your tests.
-
- util/prove6 t/foo/bar.t
-
-Make sure the outputs are what you *can* expect even if your tests fail.
-
-- If possible, please smart link your tests to the Synopsis
-
-Smart links are explained in POD:
-
- perldoc util/Text-SmartLinks/lib/Text/SmartLinks.pm
-
-You may also find the following two pugs.blogs.com posts helpful:
-
- http://pugs.blogs.com/pugs/2006/08/integrating_the.html
-
- http://pugs.blogs.com/pugs/2006/09/check_smoke_res.html
-
- http://pugs.blogs.com/pugs/2006/09/the_benefits_of.html
-
-Everytime you have added smartlinks to some .t file, remember to run
-util/smartlinks.pl to verify the links' validity:
-
- $ perl util/smartlinks.pl --check t/some/test.t
-
-By default, the freshness of the synopses will be checked every time. Use
-"--fast" to skip that step.
-
-- Dealing with parse failures
-
-When developing tests for features that have not been implemented yet,
-often you find yourself writing code that doesn't compile. Don't get
-stuck on this: wrap the new code with eval and test it anyway. Just make
-sure that the test fails as long as the eval does, and until the feature
-has been implemented correctly.
-
-Sometimes code is so futuristic, it can even confuse eval. We call this a
-"hard parsefail". When this happens, comment out the failing code, but mark
-it so it doesn't get forgotten, like this:
-
- todo :pugs<6.28.0>, v6_pm<0.110>;
- flunk("FIXME parsefail");
- #ok eval('my code here');
-
-Or another alternate style is as follows:
-
- ok eval('# $code.which(%will, @fail)');
-
- ok eval(q{
- blah blah blah
- });
-
- is(eval(q{
- my $val;
- # some code here...
- $val;
- }), $expected, 'description');
-
-which essentially comments out your eval, and returns 'undef' to ok().
-
-- When TODO and when not TODO.
-
-All of the functions in the Test module also have a 'todo' function. (See
-Test.pm's documentation for more details.)
-
-The general rule about todo tests is that if the feature is not
-yet implemented, it is TODO. But if a feature is broken, or a bug is found
-then the tests should fail and *not* be TODO.
-
-The only exception to this rule is that we TODO all failing tests before
-each point release. This is so 'make test' will succeed :)
-
-Remember, the failing test *is* your bug report.
-
-# vim: ft=text
+Here you can find the remnants of the pugs test suite.
+Most tests are nowadays maintained in a separate repository
+at http://github.com/perl6/spectests
View
@@ -1,98 +0,0 @@
- The Official Perl 6 Test Suite (someday...)
-
-This is the Official Perl 6 test suite which, although it lives
-in a corner of the pugs repo, should not be confused with pugs's
-(the Haskell implementation's) prototype test suite (as good as
-that may be). The original test suite was written with only the one
-implementation in mind; we are currently in the process of copying
-files from the pugs test suite into this directory and making them
-platform independent.
-
-In addition to copying those prototype tests in, we will keep adding
-additional tests as deemed necessary for the purpose of validating
-those implementations that wish to be known as a conforming Perl 6
-implementation. Please consider this test suite to be the result
-of an ongoing negotiation: since many of these tests are inspired
-by seeing how the various prototype implementations are screwed up
-(or even more likely, how the design of Perl 6 is screwed up), this
-test suite should be considered a work in progress till one or more
-of the implementations gets close to passing the entire test suite,
-at which point we will freeze version 6.0 of the test suite, and any
-implementation that passes it can then call itself Perl 6.
-
-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 platform and ignores all the rest. If your
-platform is named "humpty" then your special comment lines look like:
-
- #?humpty: [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 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.
-
-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, 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 platform:
-
- fudgeall humpty */*.t */*/*.t
-
-will use the "fudge" program to translate any fudged files to a new
-file where the extension is not *.t but instead is *.humpty to indicate
-the platform 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 *.humpty).
-
-
-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.
@@ -1 +0,0 @@
-This directory features tests for Perl5 embedding.
@@ -1,98 +0,0 @@
-use v6;
-
-use Test;
-
-plan 18;
-
-unless (try { eval("1", :lang<perl5>) }) {
- skip_rest;
- exit;
-}
-
-die unless
-eval(q/
-package My::Array;
-use strict;
-
-sub new {
- my ($class, $ref) = @_;
- bless \$ref, $class;
-}
-
-sub array {
- my $self = shift;
- return $$self;
-}
-
-sub my_elems {
- my $self = shift;
- return scalar(@{$$self});
-}
-
-sub my_exists {
- my ($self, $idx) = @_;
- return exists $$self->[$idx];
-}
-
-sub fetch {
- my ($self, $idx) = @_;
- return $$self->[$idx];
-}
-
-sub store {
- my ($self, $idx, $val) = @_;
- $$self->[$idx] = $val;
-}
-
-sub push {
- my ($self, $val) = @_;
- push @{$$self}, $val;
-}
-
-1;
-/, :lang<perl5>);
-
-my $p5ar = eval('sub { My::Array->new($_[0]) }', :lang<perl5>);
-my @array = (5,6,7,8);
-my $p5array = $p5ar(VAR @array);
-
-my $retarray = $p5array.array;
-
-is($p5array.my_elems, @array.elems, 'elems');
-is($p5array.my_exists(1), @array.exists(1), 'exists');
-is($p5array.my_exists(10), @array.exists(10), 'nonexists fail');
-is($p5array.fetch(3)+0, @array[3], 'fetch');
-
-my $match = 0;
-lives_ok {
- $match = ?($retarray.[3] ~~ @array[3]);
-}, 'can retro fetch';
-ok $match, 'retro fetch';
-
-is(eval(q{$retarray.elems}), @array.elems, 'retro elems');
-is($retarray.exists(1), @array.exists(1), 'retro exists');
-is($retarray.exists(10), @array.exists(10), 'retro nonexists' );
-
-ok(($p5array.push(9)), 'can push');
-
-#?pugs todo 'bug'
-is(0+$p5array.fetch(4), 9, 'push result via obj');
-#?pugs todo 'feature'
-is(@array[4], 9, 'push result via array');
-
-#?pugs todo 'bug'
-flunk("push(9) non-terminates");
-#$retarray.push(9); # this will loop
-
-#?pugs 2 todo 'bug'
-is(0+$p5array.fetch(5), 9, 'retro push result');
-is(@array[5], 9, 'retro push result');
-
-ok($p5array.store(0,3), 'can store');
-
-is(@array[0], 3, 'store result');
-is(0+$p5array.fetch(0), 3, 'store result');
-
-# TODO: pop, shift, unshift, splice, delete
-
-# vim: ft=perl6
Oops, something went wrong.

0 comments on commit 06cd519

Please sign in to comment.