Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

system_installed test finds libs and cflags

  • Loading branch information...
commit ed7a2227ec531d6d3d45659e659e321b94c16818 1 parent b9e0554
@jberger jberger authored
View
26 t/system_installed.t
@@ -1,26 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use Alien::Base::ModuleBuild;
-
-my $skip;
-system( 'pkg-config --version' );
-if ( $? ) {
- plan skip_all => "Cannot use pkg-config: $?";
-}
-
-my @installed = map { /^(\S+)/ ? $1 : () } `pkg-config --list-all`;
-my $lib = $installed[0];
-
-my $builder = Alien::Base::ModuleBuild->new(
- module_name => 'My::Test',
- dist_version => 0.01,
- alien_name => $lib,
- share_dir => 't',
-);
-
-ok(1);
-
-done_testing;
-
View
2  t/system_installed/MANIFEST
@@ -0,0 +1,2 @@
+lib/MyTest.pm
+MANIFEST This list of files
View
9 t/system_installed/lib/MyTest.pm
@@ -0,0 +1,9 @@
+package MyTest;
+
+use strict;
+use warnings;
+
+use parent 'Alien::Base';
+
+1;
+
View
50 t/yy-system_installed.t
@@ -0,0 +1,50 @@
+use strict;
+use warnings;
+
+use File::chdir;
+
+use Test::More;
+use Alien::Base::ModuleBuild;
+
+local $CWD;
+push @CWD, qw/t system_installed/;
+
+my $skip;
+system( 'pkg-config --version' );
+if ( $? ) {
+ plan skip_all => "Cannot use pkg-config: $?";
+}
+
+my @installed = map { /^(\S+)/ ? $1 : () } `pkg-config --list-all`;
+my $lib = $installed[0];
+
+my $cflags = `pkg-config --cflags $lib`;
+my $libs = `pkg-config --libs $lib`;
+
+my $builder = Alien::Base::ModuleBuild->new(
+ module_name => 'MyTest',
+ dist_version => 0.01,
+ alien_name => $lib,
+ share_dir => 't',
+);
+
+$builder->depends_on('build');
+
+{
+ local $CWD;
+ push @CWD, qw/blib lib/;
+
+ require MyTest;
+ my $alien = MyTest->new;
+
+ isa_ok($alien, 'MyTest');
+ isa_ok($alien, 'Alien::Base');
+
+ is($alien->cflags, $cflags, "get cflags from system-installed library");
+ is($alien->libs , $libs , "get libs from system-installed library" );
+}
+
+$builder->depends_on('realclean');
+
+done_testing;
+
Please sign in to comment.
Something went wrong with that request. Please try again.