@@ -15,8 +15,7 @@ in the [#perl6 IRC channel](https://perl6.org/community/irc).
15
15
# TABLE OF CONTENTS
16
16
- [ General principles] ( #general-principles )
17
17
- [ Documenting types] ( #documenting-types )
18
- - [ Testing examples] ( #testing-examples )
19
- - [ Skipping tests] ( #skipping-tests )
18
+ - [ Writing and Testing examples] ( #writing-and-testing-examples )
20
19
- [ Debug mode] ( #debug-mode )
21
20
- [ Invisible index anchors] ( #invisible-index-anchors )
22
21
- [ Viewport size] ( #viewport-size )
@@ -113,70 +112,9 @@ tests about whitespace and spelling that might be difficult to get right
113
112
on an initial commit, and shouldn't be considered to break the build. If
114
113
you're contributing a patch or pull request, please make sure this passes.
115
114
116
- ## Testing examples
115
+ ## Writing and testing examples
117
116
118
- To export examples from all .pod6-files use ` make extract-examples ` . To run
119
- individual tests pick the right .p6-file from ` examples/ ` as a parameter to
120
- ` perl6 ` .
121
-
122
- ### Skipping tests
123
-
124
- Some examples fail with compile time exceptions and would interrupt the test
125
- for a file. Use the pod-config option ` skip-test ` to skip them.
126
-
127
- =begin code :skip-test
128
- your-example-here();
129
- =end code
130
-
131
- In other cases, the snippet of code isn't Perl 6; in that case, mark the
132
- language, which will also skip the test.
133
-
134
- =begin code :lang<tcl>
135
- puts "this is not Perl"
136
- =end code
137
-
138
- When writing examples, it's often helpful to refer to things that aren't
139
- defined in that snippet; you don't want to have to have a full working
140
- example in the code.
141
-
142
- =begin code :preamble<no strict;>
143
- $x = pi;
144
- =end code
145
-
146
- =begin code :preamble<my $x; sub frob {...};>
147
- $x = frob();
148
- =end code
149
-
150
- You can disable certain checks with : ok-test , allowing us to
151
- generally fail certain styles, but allow them when it is explicitly the
152
- point of the code.
153
-
154
- =begin code :ok-test<WHAT>
155
- say 42.WHAT;
156
- =end
157
-
158
- If a code snippet looks like a method declaration, it's automatically
159
- wrapped in additional code so you don't have to specify a body in the docs.
160
- Multi-line method signatures are much harder to detect, so if you have a
161
- method body that spans likes, use the : method tag:
162
-
163
- =begin code :method
164
- method arg (
165
- Bool $one,
166
- Bool $two
167
- )
168
- =end code
169
-
170
-
171
- ### Catching expected exception
172
-
173
- Some tests will throw exceptions that would stop the execution of the extracted
174
- test file. Use the pod-option ` catch-all ` to have a default handler installed
175
- for a single example.
176
-
177
- =begin code :catch-all
178
- exception-generator-here();
179
- =end code
117
+ See [ EXAMPLES] .
180
118
181
119
## Testing method completeness
182
120
0 commit comments