| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use Test::More tests => 6; |
| 5 |
|
| 6 |
use XS::APItest; |
| 7 |
|
| 8 |
my @cases = ( |
| 9 |
[field => '%2$d'], |
| 10 |
[precision => '%.*2$d'], |
| 11 |
[vector => '%2$vd'], |
| 12 |
[width => '%*2$d'], |
| 13 |
); |
| 14 |
|
| 15 |
for 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. |
| 24 |
is(test_HvNAMEf(bless {}, "Whatever::You::Like"), |
| 25 |
"class='Whatever::You::Like'"); |
| 26 |
is(test_HvNAMEf_QUOTEDPREFIX(bless {}, "x" x 1000), |
| 27 |
'class="xxxxxxxxxxxxxxxxxxxxxxxxxx'. |
| 28 |
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. |
| 29 |
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..."xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. |
| 30 |
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'. |
| 31 |
'xxxxxxxxxxxxxxxxxxxxx"'); |