source:
NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/EXTERNAL/fcm/t/Fcm/Util.t
@
10761
Last change on this file since 10761 was 10761, checked in by jcastill, 5 years ago | |
---|---|
File size: 1.3 KB |
Line | |
---|---|
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More qw{no_plan}; |
7 | |
8 | main(); |
9 | |
10 | sub main { |
11 | use_ok('Fcm::Util'); |
12 | test_tidy_url(); |
13 | } |
14 | |
15 | ################################################################################ |
16 | # Tests tidy_url |
17 | sub test_tidy_url { |
18 | my $prefix = "tidy_url"; |
19 | my %RESULT_OF = ( |
20 | '' => '', |
21 | 'foo' => 'foo', |
22 | 'foo/bar' => 'foo/bar', |
23 | 'http://foo/bar' => 'http://foo/bar', |
24 | 'http://foo/bar@1234' => 'http://foo/bar@1234', |
25 | 'http://foo/bar/@1234' => 'http://foo/bar@1234', |
26 | 'http://foo/bar/.' => 'http://foo/bar', |
27 | 'http://foo/bar/.@1234' => 'http://foo/bar@1234', |
28 | 'http://foo/bar/./@1234' => 'http://foo/bar@1234', |
29 | 'http://foo/bar/./baz' => 'http://foo/bar/baz', |
30 | 'http://foo/bar/..' => 'http://foo', |
31 | 'http://foo/bar/..@1234' => 'http://foo@1234', |
32 | 'http://foo/bar/../@1234' => 'http://foo@1234', |
33 | 'http://foo/bar/../baz' => 'http://foo/baz', |
34 | 'http://foo/bar/../.' => 'http://foo', |
35 | 'http://foo/bar/baz/../..' => 'http://foo', |
36 | ); |
37 | for my $key (sort keys(%RESULT_OF)) { |
38 | is(tidy_url($key), $RESULT_OF{$key}, "$prefix: $key"); |
39 | } |
40 | } |
41 | |
42 | # TODO: more unit tests |
43 | |
44 | __END__ |
Note: See TracBrowser
for help on using the repository browser.