1#!/usr/bin/perl
2use strict;
3use warnings;
4
5use Test::More tests => 2;
6use ExtUtils::Typemaps;
7
8SCOPE: {
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");
13TYPEMAP
14unsigned int	T_UV
15
16INPUT
17T_UV
18  $var = ($type)SvUV($arg);
19HERE
20}
21
22
23SCOPE: {
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");
28TYPEMAP
29unsigned int	T_UV
30
31INPUT
32T_UV
33  $var =
34	($type)
35          SvUV($arg);
36HERE
37}
38
39