root/t/README

Revision 21775, 6.7 kB (checked in by moritz, 4 months ago)

[t] some updates to README, and fixed all but one smartlink in t/spec/

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1===============================================================================
2|    ______                           ______                 __               |
3|  /\   __ \                         /\__  _\               _\ \__            |
4|  \ \  \/\ \ __  __  ______  ______ \/_/\ \/ ______  _____/\__  _\______     |
5|   \ \   __//\ \/\ \/\  __ \/\  ___\   \ \ \/\  ___\/\  ___\_/\ \/\  ___\    |
6|    \ \  \/ \ \ \_\ \ \ \/\ \ \___  \   \ \ \ \  ___\ \___  \\ \ \_\___  \   |
7|     \ \__\  \ \____/\ \____ \/\_____\   \ \_\ \_____\/\_____\\ \ _\\_____\  |
8|      \/__/   \/___/  \/___/\ \/____/     \/_/\/____/ \/____/  \/__//____/   |
9|                        /\____/                                              |
10|                        \/___/                                               |
11|                                                                             |
12===============================================================================
13
14                     Welcome to the Pugs Test suite.
15
16Pugs is currently being developed in a highly test-driven manner. Tests are
17written for both implemented and unimplemented features and are based roughly
18on the Perl6 Language Synopsis documents. All are welcome and encouraged to
19contribute to this test suite. The part under spec/ is considered to be the
20offical Perl 6 test suite, and should only test what is specified in the
21Synopsis documents. It is also used by other Perl 6 implementations.
22
23-------------------------------------------------------------------------------
24Getting Started
25-------------------------------------------------------------------------------
26
27Here are some basic guidelines to help you get started writing tests for Pugs.
28
29- Prerequisites
30
31Please read the Perl 6 Spec first, namely, the Synopses:
32
33  http://perlcabal.org/syn/
34
35or directly from the SVN repos:
36
37  http://svn.perl.org/perl6/doc/trunk/design/syn
38
39A good grasp of the Perl 6 language itself is very important to writing good
40tests.
41
42- If you are unsure of something, don't hesitate to ask.
43
44If you have a question about a test, written or unwritten, log on to #perl6 on
45irc.freenode.net or send an email to perl6-compiler and ask someone about it.
46If you have read the synopses very carefully and are still unsure about a
47perl6 language element, we encourage you to ask on #perl6 or email the
48perl6-language list and get clarification. Pugs and Perl 6 are group efforts
49and asking questions is a good thing.
50
51- What to test
52
53A number of Pugs hackers on #perl6 run regular smoke tests, and you can run
54your own using 'make smoke'. The smoke test produces an HTML graph of what tests
55are passing, and what aren't. This can be a good place to start. There's a smoke
56server on the web:
57
58  http://m19s28.dyndns.org/cgi-bin/pugs-smokeserv.pl?
59
60There is also a cross linking which is made between the tests and the synopses.
61It's generated by running the 'util/smartlinks.pl' script. You
62can generate an HTML version of the latest Synopses cross-referenced with test
63file snippets from the test suite using the following command:
64
65    $ util/smartlinks.pl t/*/*.t t/*/*/*.t
66
67There's a cross-referenced version of Synopses at
68
69    http://perlcabal.org/syn/
70
71which is automatically updated by the smartlinks.pl script on feather once
72an hour.
73
74- Use the Test module.
75
76We have created a basic Test module found in ext/Test/lib/Test.pm. It is
77written in Perl 6 and implements the TAP protocol (and so can be used with
78Test::Harness). The module has its own documentation and I encourage you to
79read it.
80
81- Pugs tests should have a non-she-bang line of "use v6;".
82
83This line helps both Test::Harness as well as the 'prove6' utility when
84running Pugs tests.
85
86- Place tests in the appropriate folder.
87
88We have recently undergone a re-organization of the test suite in order to
89make it easier to find what has and has not been tested. It is important as
90the test suite grows that we try to keep this organization. If you have a test
91and are unsure of where to put it, ask on #perl6 for help, or put it in the
92general/ folder and email perl6-compiler and let us know.
93
94Tests that belong to one synopsis document should go under
95t/spec/SXX-SECTION/, where XX is the number of the synopsis and SECTION is the
96title (or an important key word of the title) under which the tested behaviour
97is described.
98
99Warning: please grep the whole test suite to ensure the tests you want to add
100are not already in some file.
101
102- Run the test file with util/prove6 to test your tests.
103
104  util/prove6 t/foo/bar.t
105
106Make sure the outputs are what you *can* expect even if your tests fail.
107
108- If possible, please smart link your tests to the Synopsis
109
110Smart links are explained on the wiki:
111
112  http://rakudo.org/perl6/index.cgi?smart_linking
113
114And in the POD of smartlinks.pl:
115
116  perldoc util/smartlinks.pl
117
118You may also find the following two pugs.blogs.com posts helpful:
119
120  http://pugs.blogs.com/pugs/2006/08/integrating_the.html
121
122  http://pugs.blogs.com/pugs/2006/09/check_smoke_res.html
123
124  http://pugs.blogs.com/pugs/2006/09/the_benefits_of.html
125
126Everytime you have added smartlinks to some .t file, remember to run
127util/smartlinks.pl to verify the links' validity:
128
129   $ perl util/smartlinks.pl --check t/some/test.t
130
131By default, the freshness of the synopses will checked every time. Use "--fast"
132to skip that step.
133
134- Dealing with parse failures
135
136When developing tests for features that have not been implemented yet,
137often you find yourself writing code that doesn't compile. Don't get
138stuck on this: wrap the new code with eval and test it anyway. Just make
139sure that the test fails as long as the eval does, and until the feature
140has been implemented correctly.
141
142Sometimes code is so futuristic, it can even confuse eval. We call this a
143"hard parsefail". When this happens, comment out the failing code, but mark
144it so it doesn't get forgotten, like so:
145
146    todo :pugs<6.28.0>, v6_pm<0.110>;
147    flunk("FIXME parsefail");
148    #ok eval('my code here');
149   
150Or another alternate style is as follows:
151
152    ok eval('# $code.which(%will, @fail)');
153
154    ok eval(q{
155        blah blah blah
156    });
157
158    is(eval(q{
159        my $val;
160        # some code here...
161        $val;
162    }), $expected, 'description');
163
164which essentially comments out your eval, and returns 'undef' to ok().
165
166- When TODO and when not TODO.
167
168All of the functions in the Test module also have a 'todo' function. (See
169Test.pm's documentation for more details.)
170
171The general rule about todo tests is that if the feature is not
172yet implemented, it is TODO. But if a feature is broken, or a bug is found
173then the tests should fail and *not* be TODO.
174
175The only exception to this rule is that we TODO all failing tests before
176each point release. This is so 'make test' will succeed :)
177
178Remember, the failing test *is* your bug report.
179
180# vim: ft=text
Note: See TracBrowser for help on using the browser.