#!/usr/bin/perl use strict; use warnings; # tests for the quick-n-dirty interface for XS inclusion use Test::More tests => 6; use File::Spec; use ExtUtils::Typemaps::Cmd; my $datadir = -d 't' ? File::Spec->catdir(qw/t data/) : 'data'; my $libdir = -d 't' ? File::Spec->catdir(qw/t lib/) : 'lib'; unshift @INC, $libdir; sub slurp { my $file = shift; open my $fh, '<', $file or die "Cannot open file '$file' for reading: $!"; local $/ = undef; return <$fh>; } sub permute (&@) { my $code = shift; my @idx = 0..$#_; while ( $code->(@_[@idx]) ) { my $p = $#idx; --$p while $idx[$p-1] > $idx[$p]; my $q = $p or return; push @idx, reverse splice @idx, $p; ++$q while $idx[$p-1] > $idx[$q]; @idx[$p-1,$q]=@idx[$q,$p-1]; } } SCOPE: { no warnings 'once'; ok(defined(*embeddable_typemap{CODE}), "function exported"); } my $start = "TYPEMAP: <catfile($datadir, "simple.typemap"); is( embeddable_typemap($typemap_file), $start . slurp($typemap_file) . $end, "embeddable typemap from file" ); my $foo_content = <