This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Locale::Codes to 3.12
[perl5.git] / cpan / Locale-Codes / examples / README.examples
1 Please refer to the ../t directory for examples of how to use this
2 module.
3
4 The tests are organized fairly simply. In each .t file (except for
5 pod and pod_coverage) is a line of the form:
6
7   test_Func(\&FUNC,$tests,$runtests,ARGS)
8
9 FUNC is the name of one of the functions available in the module,
10 or some function defined in the test script which calls one or more
11 of the module functions.
12
13 Also in the file are a series of tests organized as:
14
15    $tests = "
16    TEST1
17
18    TEST2
19
20    ...
21    ";
22
23 or
24
25   $tests = [
26   TEST1,
27
28   TEST2,
29
30   ... ];
31
32
33 In the first case, a test is a list of strings, some of which are used
34 as arguments for the function being called, and some are expected results.
35 If the expected result is a simple scalar, each TEST may be a simple list
36 of space separated strings, the last of which is treated as the expected
37 output.
38
39 For example, if the following line appears in the test script:
40
41   test_Func(\&somefunc,$tests,$runtests);
42
43 and one of the tests is:
44
45   A B C
46
47 then the following behavior is expected:
48
49   somefunc(A,B)
50      => C
51
52 The list of strings may also be given on separate lines as:
53
54   A
55   B
56   C
57
58 If the expected results are a list of values, then the arguments
59 to the function and the expected results are separated by a tilde (~).
60 So if the following behavior is expected:
61
62   somefunc(A,B)
63      => (C,D)
64
65 the test could be written in either of the following ways:
66
67   A B ~ C D
68
69   A
70   B
71   ~
72   C
73   D
74
75 In all cases, leading spaces are ignored. Also, the strings may include
76 spaces if (and only if) they are given one per line.
77
78 Two special strings "_undef_" and "_blank_" may be included in the list
79 to have the values undef or "" repectively included as either an argument
80 or an expected return value.
81
82
83 In the second method of entering tests, tests are given as a list reference
84 with two values. The first is a list reference containing arguments, and
85 the second is a list reference containing the expected return value(s). The
86 expected values should be simple strings.
87
88 So, a test could be entered as:
89
90   [ [ qw(A B) ],
91     [ qw(C D) ] ]
92
93 and be equivalent to:
94
95   A B ~ C D
96