-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4282cf5
commit 1b3aba5
Showing
4 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ README.md | |
t/00-load.t | ||
t/10-compile.t | ||
t/20-new.t | ||
t/30-basics.t | ||
t/allow.t | ||
t/apoc.t | ||
t/as_string.t | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::Most tests => 8; | ||
|
||
# Load the module being tested | ||
BEGIN { use_ok('CGI::Info') } | ||
|
||
local %ENV; | ||
$ENV{'SCRIPT_NAME'} = 'test_script'; | ||
$ENV{'HTTP_USER_AGENT'} = 'Mozilla/5.0'; | ||
|
||
# Test object creation | ||
my $cgi_info = CGI::Info->new(); | ||
ok($cgi_info, 'CGI::Info object created'); | ||
|
||
# Test script_name method | ||
can_ok($cgi_info, 'script_name'); | ||
my $script_name = $cgi_info->script_name(); | ||
is($script_name, $ENV{'SCRIPT_NAME'}, 'script_name matches the environment variable'); | ||
|
||
# Test host_name method | ||
can_ok($cgi_info, 'host_name'); | ||
like($cgi_info->host_name(), qr/\w+/, 'host_name returns a valid string'); | ||
|
||
# Test is_mobile method | ||
can_ok($cgi_info, 'is_mobile'); | ||
is($cgi_info->is_mobile(), 0, 'is_mobile returns false by default (not a mobile device)'); |