<commit_before>use v6;
use Test;
plan *;

# L<S02/Literals/"A bare closure also interpolates in double-quotish context.">

{
    # The code of the closure takes a reference to the number 1, discards it
    # and finally returns 42.
    is "{\01;42}", "42", '{\\01 parses correctly (1)';
    is "{;\01;42}", "42", '{\\01 parses correctly (2)';
    is "{;;;;;;\01;42}", "42", '{\\01 parses correctly (3)';
}

{
    is "{\1;42}", "42", '{\\1 parses correctly (1)';
    is "{;\1;42}", "42", '{\\1 parses correctly (2)';
    is "{;;;;;;\1;42}", "42", '{\\1 parses correctly (3)';
}


{
    # interpolating into double quotes results in a Str
    my $a = 3;
    ok "$a" ~~ Str, '"$a" results in a Str';
    ok "{3}" ~~ Str, '"{3}" results in a Str';
}

my $rt65538_in = qq[line { (1,2,3).min }
line 2
line { (1,2,3).max } etc
line 4
];
my $rt65538_out = qq[line 1
line 2
line 3 etc
line 4
];
#?rakudo todo 'RT 65538'
is $rt65538_in, $rt65538_out, 'interpolation does not trim newlines';

done_testing;

# vim: ft=perl6<commit_msg>[t/spec] Fudged a test in S02-literals/string-interpolation.t<commit_after>use v6;
use Test;
plan *;

# L<S02/Literals/"A bare closure also interpolates in double-quotish context.">

{
    # The code of the closure takes a reference to the number 1, discards it
    # and finally returns 42.
    is "{\01;42}", "42", '{\\01 parses correctly (1)';
    is "{;\01;42}", "42", '{\\01 parses correctly (2)';
    is "{;;;;;;\01;42}", "42", '{\\01 parses correctly (3)';
}

{
    is "{\1;42}", "42", '{\\1 parses correctly (1)';
    is "{;\1;42}", "42", '{\\1 parses correctly (2)';
    is "{;;;;;;\1;42}", "42", '{\\1 parses correctly (3)';
}


{
    # interpolating into double quotes results in a Str
    my $a = 3;
    #?rakudo todo 'Is Int, not Str'
    ok "$a" ~~ Str, '"$a" results in a Str';
    ok "{3}" ~~ Str, '"{3}" results in a Str';
}

my $rt65538_in = qq[line { (1,2,3).min }
line 2
line { (1,2,3).max } etc
line 4
];
my $rt65538_out = qq[line 1
line 2
line 3 etc
line 4
];
#?rakudo todo 'RT 65538'
is $rt65538_in, $rt65538_out, 'interpolation does not trim newlines';

done_testing;

# vim: ft=perl6
{'fraction_non_alphanumeric': 0.20919324577861162, 'fraction_numerical': 0.0900562851782364, 'mean_word_length': 3.2574850299401197, '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': '7230145', 'n_tokens_mistral': 961, 'n_tokens_neox': 858, 'n_words': 284}