<commit_before>use v6-alpha;

use Test;

plan 11;

# L<S29/Str/capitalize>

is capitalize(""),             "",               "capitalize('') works";
is capitalize("puGS Is cOOl!"), "Pugs Is Cool!", "capitalize('...') works";
is "puGS Is cOOl!".capitalize,  "Pugs Is Cool!", "'...'.capitalize works";

my $a = "";
is capitalize($a),             "",               "capitalize empty string";
$a = "puGS Is cOOl!";
is capitalize($a),             "Pugs Is Cool!",  "capitalize string works";
is $a,                         "puGS Is cOOl!",  "original string not touched";
is $a.capitalize,              "Pugs Is Cool!",  "capitalize string works";
is $a,                         "puGS Is cOOl!",  "original string not touched";
is "ab cD Ef".capitalize,      "Ab Cd Ef",       "works on ordinary string";


#?rakudo eval "can't parse"
{
    $_ = "puGS Is cOOl!";
    is .capitalize, "Pugs Is Cool!", 'capitalize() uses \$_ as default';
}

# Non-ASCII chars:
#?rakudo skip "unicode"
is capitalize("äöü abcä"), "Äöü Abcä", "capitalize() works on non-ASCII chars";<commit_msg>s/eval/skip/ because rakudo doesn't do eval yet<commit_after>use v6-alpha;

use Test;

plan 11;

# L<S29/Str/capitalize>

is capitalize(""),             "",               "capitalize('') works";
is capitalize("puGS Is cOOl!"), "Pugs Is Cool!", "capitalize('...') works";
is "puGS Is cOOl!".capitalize,  "Pugs Is Cool!", "'...'.capitalize works";

my $a = "";
is capitalize($a),             "",               "capitalize empty string";
$a = "puGS Is cOOl!";
is capitalize($a),             "Pugs Is Cool!",  "capitalize string works";
is $a,                         "puGS Is cOOl!",  "original string not touched";
is $a.capitalize,              "Pugs Is Cool!",  "capitalize string works";
is $a,                         "puGS Is cOOl!",  "original string not touched";
is "ab cD Ef".capitalize,      "Ab Cd Ef",       "works on ordinary string";


# should be eval but rakudo doesn't do eval yet...
#?rakudo skip "can't parse"
{
    $_ = "puGS Is cOOl!";
    is .capitalize, "Pugs Is Cool!", 'capitalize() uses \$_ as default';
}

# Non-ASCII chars:
#?rakudo skip "unicode"
is capitalize("äöü abcä"), "Äöü Abcä", "capitalize() works on non-ASCII chars";
{'fraction_non_alphanumeric': 0.16794236830256642, 'fraction_numerical': 0.004502476361999099, 'mean_word_length': 2.5552, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6845733', 'n_tokens_mistral': 812, 'n_tokens_neox': 763, 'n_words': 246}