Permalink
Browse files

Added tests with data from real runs from CPAN testers

  • Loading branch information...
1 parent 7f3d689 commit 3427cea61631fef1bcb10ae8c957d8c5c9ab037d Colin committed Jul 6, 2010
Showing with 29 additions and 2 deletions.
  1. +2 −1 lib/Devel/Platform/Info/Mac.pm
  2. +27 −1 t/51mac_mock.t
@@ -21,6 +21,7 @@ sub new {
sub get_info {
my $self = shift;
$self->{info}{osname} = 'Mac';
+ $self->{info}{osflag} = $^O;
my $uname_s = $self->_command('uname -s');
if ($uname_s =~ /Darwin/i) {
@@ -160,4 +161,4 @@ RT Queue: http://rt.cpan.org/Public/Dist/Display.html?Name=Devel-Platform-Info
This module is free software; you can redistribute it and/or
modify it under the Artistic License 2.0.
-=cut
+=cut
View
@@ -7,7 +7,7 @@ use Devel::Platform::Info::Mac;
eval "use Test::MockObject::Extends";
plan skip_all => "Test::MockObject::Extends required for these tests" if $@;
-plan tests => 9;
+plan tests => 9*3;
my $macInfo = Devel::Platform::Info::Mac->new();
my $mock = Test::MockObject::Extends->new($macInfo);
@@ -24,5 +24,31 @@ is($info->{is32bit}, 1);
is($info->{is64bit}, 0);
is($info->{kernel}, 'Darwin 1');
+$mock->set_series('_command', 'Darwin', '10.4.11', 'powerpc', 'Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC', 'Darwin somewhere.co.uk 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc');
+$info = $macInfo->get_info();
+
+is($info->{osname}, 'Mac');
+is($info->{osflag}, $^O);
+is($info->{oslabel}, 'OS X');
+is($info->{codename}, 'Tiger');
+is($info->{osvers}, '10.4.11');
+is($info->{archname}, 'powerpc');
+is($info->{is32bit}, 1);
+is($info->{is64bit}, 0);
+is($info->{kernel}, 'Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC');
+
+$mock->set_series('_command', 'Darwin', '10.4.11', 'i386', 'Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386', 'Darwin somehost 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386');
+$info = $macInfo->get_info();
+
+is($info->{osname}, 'Mac');
+is($info->{osflag}, $^O);
+is($info->{oslabel}, 'OS X');
+is($info->{codename}, 'Tiger');
+is($info->{osvers}, '10.4.11');
+is($info->{archname}, 'i386');
+is($info->{is32bit}, 1);
+is($info->{is64bit}, 0);
+is($info->{kernel}, 'Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386');
+
# use Data::Dumper;
# print Dumper($info);

0 comments on commit 3427cea

Please sign in to comment.