File: 30-linker-elf-gcc.t

package info (click to toggle)
libextutils-builder-compiler-perl 0.032-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: perl: 1,252; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 1,096 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! perl

use strict;
use warnings;

use Test::More 0.89;
BEGIN {
	*eq_or_diff = eval { require Test::Differences } ? \&Test::Differences::eq_or_diff : \&Test::More::is_deeply;
}

use ExtUtils::Builder::Linker::ELF::Any;

{
	my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'executable');
	eq_or_diff([ $linker->link(['file.o'], 'file')->to_command ], [[qw/cc -o file file.o/]], 'Got "cc -o file file.o"');
}

{
	my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'shared-library');
	eq_or_diff([ $linker->link(['file.o'], 'file.so')->to_command ], [[qw/cc -shared -o file.so file.o/]], 'Got "cc -shared -o file.so file.o"');
}

{
	my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'loadable-object');
	eq_or_diff([ $linker->link(['file.o'], 'file')->to_command ], [[qw/cc -shared -o file file.o/]], 'Got "cc -o file -c file.o"');
}

done_testing;