xref: /openbsd-src/gnu/usr.bin/perl/ext/XS-APItest/t/svcatpvf.t (revision e068048151d29f2562a32185e21a8ba885482260)
1use strict;
2use warnings;
3
4use Test::More tests => 6;
5
6use XS::APItest;
7
8my @cases = (
9    [field     => '%2$d'],
10    [precision => '%.*2$d'],
11    [vector    => '%2$vd'],
12    [width     => '%*2$d'],
13);
14
15for my $case (@cases) {
16    my ($what, $format) = @$case;
17    my $got = eval { test_sv_catpvf($format); 1 };
18    my $exn = $got ? undef : $@;
19    like($exn, qr/\b\QCannot yet reorder sv_vcatpvfn() arguments from va_list\E\b/,
20         "explicit $what index forbidden in va_list arguments");
21}
22
23# these actually test newSVpvf() but it is the same underlying logic.
24is(test_HvNAMEf(bless {}, "Whatever::You::Like"),
25    "class='Whatever::You::Like'");
26is(test_HvNAMEf_QUOTEDPREFIX(bless {}, "x" x 1000),
27    'class="xxxxxxxxxxxxxxxxxxxxxxxxxx'.
28    'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
29    'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..."xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
30    'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
31    'xxxxxxxxxxxxxxxxxxxxx"');
32