From 052d0ddb15b3df70da685d06eda9218639edb835 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 19 Oct 2006 17:49:51 +0000 Subject: [PATCH] Os tests covering all possible, valid operating systems. Also has 100% test coverage --- t/Session/Os.t | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/t/Session/Os.t b/t/Session/Os.t index d42a63d6d..b089422d6 100644 --- a/t/Session/Os.t +++ b/t/Session/Os.t @@ -14,10 +14,39 @@ use lib "$FindBin::Bin/../lib"; use WebGUI::Test; use WebGUI::Session; +use WebGUI::Session::Os; -use Test::More tests => 2; # increment this value for each test you create +my @testSets = ( + { + os => 'Win', + type => 'Windowsish', + }, + { + os => 'win32', + type => 'Windowsish', + }, + { + os => 'MSWin32', + type => 'Windowsish', + }, + { + os => 'Amiga OS', + type => 'Linuxish', + }, +); + +use Test::More; + +my $numTests = 2 * scalar @testSets; + +plan tests => $numTests; my $session = WebGUI::Test->session; -ok($session->os->get("name") ne "", "get(name)"); -ok($session->os->get("type") eq "Windowsish" || $session->os->get("type") eq "Linuxish", "get(type)"); +foreach my $test (@testSets) { + local $^O = $test->{os}; + my $os = WebGUI::Session::Os->new($session); + is($os->get('name'), $test->{os}, "$test->{os}: name set"); + is($os->get('type'), $test->{type}, "$test->{os}: type set"); +} +