This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlapi: XS, XS_EXTERNAL do take a parameter
[perl5.git] / ext / Sys-Hostname / t / Hostname.t
1 #!./perl
2
3 BEGIN {
4     require Config; import Config;
5     if ($Config{'extensions'} !~ /\bSys\/Hostname\b/) {
6       print "1..0 # Skip: Sys::Hostname was not built\n";
7       exit 0;
8     }
9 }
10
11 use Sys::Hostname;
12
13 use Test::More tests => 2;
14
15 SKIP:
16 {
17     eval {
18         $host = hostname;
19     };
20     skip "No hostname available", 1
21       if $@ =~ /Cannot get host name/;
22     isnt($host, undef, "got a hostname");
23 }
24
25 {
26     local $@;
27     eval { hostname("dummy"); };
28     like($@,
29         qr/hostname\(\) does not accepts arguments \(it used to silently discard any provided\)/,
30         "hostname no longer accepts arguments"
31     );
32 }