Debian Codegraph @

dist/ExtUtils-ParseXS/t/511-t-whitespace.t

raw
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::More tests => 2;
6 use ExtUtils::Typemaps;
7
8 SCOPE: {
9 my $map = ExtUtils::Typemaps->new();
10 $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV');
11 $map->add_inputmap(xstype => 'T_UV', code => ' $var = ($type)SvUV($arg);');
12 is($map->as_string(), <<'HERE', "Simple typemap (with input and code including leading whitespace) matches expectations");
13 TYPEMAP
14 unsigned int T_UV
15
16 INPUT
17 T_UV
18 $var = ($type)SvUV($arg);
19 HERE
20 }
21
22
23 SCOPE: {
24 my $map = ExtUtils::Typemaps->new();
25 $map->add_typemap(ctype => 'unsigned int', xstype => 'T_UV');
26 $map->add_inputmap(xstype => 'T_UV', code => " \$var =\n(\$type)\n SvUV(\$arg);");
27 is($map->as_string(), <<'HERE', "Simple typemap (with input and multi-line code) matches expectations");
28 TYPEMAP
29 unsigned int T_UV
30
31 INPUT
32 T_UV
33 $var =
34 ($type)
35 SvUV($arg);
36 HERE
37 }
38