<commit_before>=encoding utf8

=head1 TITLE

Synopsis 24: Testing

=head1 AUTHORS

    <NAME> <<EMAIL>>
    <NAME> <<EMAIL>>

=head1 VERSION

    Created: 30 Dec 2010

    Last Modified: 31 Dec 2010
    Version: 5

=head1 SYNOPSIS

    use Test;

    plan 6;

    ok True, 'True is a true value';
    nok False, 'False is a false value';
    is 'ab'.uc, 'AB', 'successful string comparison';
    is_approx 2.sqrt, 1.4142135623, 'Approximate numeric comparison';
    dies_ok { die "yes"}, 'exceptions';
    eval_dies_ok '1 1', 'two terms in a row are a parse error';


=head1 DESCRIPTION

Perl 6 comes with a standard testing module, C<Test>. It is the testing module
used by the official spectest suite.

The testing functions emit output conforming to the Test Anything
Protocol. See L<http://testanything.org>.

For the purposes of this document, a I<test file> is a file that does
C<use Test>.

=head2 Test plans

    sub plan($number_of_tests) is export { ... };
    sub done() is export { ... };

In order to determine whether a test file ran all its tests, a C<plan> function
call can be made somewhere in the test file, providing a count of the total
number of tests. A TAP harness can then flag an error condition when the number
of tests actually run doesn't match.

If C<plan> isn't called, C<done> can be called at the end of the test
file to output an automatically computed tally.

A TAP harness will consider it an error if neither C<plan> nor
C<done> was called, or if there was more than one call in the test
file, or if the call occurred between calling two test functions
(rather than at the beginning or at the end).

=head2 Test functions

All test functions take a description argument, which will be
printed along with the C<ok> or C<not ok> result and the test
number. Except in the case of the functions C<pass> and C<flunk>,
this description is optional.

The names of positional parameters are non-normative, so supplying the
positional arguments to these test files by name is discouraged.

All of the following functions are exported by default:

    # unconditional passing/failing
    pass($desc)
    flunk($desc)

    # evaluates $cond in boolean context
    ok(Mu $cond, $desc?)
    nok(Mu $cond, $desc?)

    # string comparison
    is(Mu $got, Mu $expected, $desc?)<commit_msg>[S24] made all parameters optional<commit_after>=encoding utf8

=head1 TITLE

Synopsis 24: Testing

=head1 AUTHORS

    <NAME> <<EMAIL>>
    <NAME> <<EMAIL>>

=head1 VERSION

    Created: 30 Dec 2010

    Last Modified: 31 Dec 2010
    Version: 6

=head1 SYNOPSIS

    use Test;

    plan 6;

    ok True, 'True is a true value';
    nok False, 'False is a false value';
    is 'ab'.uc, 'AB', 'successful string comparison';
    is_approx 2.sqrt, 1.4142135623, 'Approximate numeric comparison';
    dies_ok { die "yes"}, 'exceptions';
    eval_dies_ok '1 1', 'two terms in a row are a parse error';


=head1 DESCRIPTION

Perl 6 comes with a standard testing module, C<Test>. It is the testing module
used by the official spectest suite.

The testing functions emit output conforming to the Test Anything
Protocol. See L<http://testanything.org>.

For the purposes of this document, a I<test file> is a file that does
C<use Test>.

=head2 Test plans

    sub plan($number_of_tests) is export { ... };
    sub done() is export { ... };

In order to determine whether a test file ran all its tests, a C<plan> function
call can be made somewhere in the test file, providing a count of the total
number of tests. A TAP harness can then flag an error condition when the number
of tests actually run doesn't match.

If C<plan> isn't called, C<done> can be called at the end of the test
file to output an automatically computed tally.

A TAP harness will consider it an error if neither C<plan> nor
C<done> was called, or if there was more than one call in the test
file, or if the call occurred between calling two test functions
(rather than at the beginning or at the end).

=head2 Test functions

All test functions take an optional description argument, which
will be printed along with the C<ok> or C<not ok> result and the test
number. Note that what is displayed as optional parameters in the list
below might as well be implemented by some other mechanism, such as
several C<multi sub>s. Such details are left as implementation-dependent.

The names of positional parameters are non-normative, so supplying the
positional arguments to these test files by name is discouraged.

All of the following functions are exported by default:

    # unconditional passing/failing
    pass($desc?)
    flunk($desc?)

    # evaluates $cond in boolean context
    ok(Mu $cond, $desc?)
    nok(Mu $cond, $desc?)

    # string comparison
    is(Mu $got, Mu $expected, $desc?)
{'fraction_non_alphanumeric': 0.07376362112321877, 'fraction_numerical': 0.016764459346186086, 'mean_word_length': 3.652046783625731, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1595968', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1347, 'n_words': 712}