Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package main |
||
2 | |||
3 | import ( |
||
4 | "path/filepath" |
||
5 | "testing" |
||
6 | ) |
||
7 | |||
8 | func TestFilterIpV4(t *testing.T) { |
||
9 | } |
||
10 | |||
11 | func TestFolderOfPanic1(t *testing.T) { |
||
12 | defer func() { |
||
13 | if r := recover(); r == nil { |
||
14 | t.Errorf("The code did not panic") |
||
15 | } |
||
16 | }() |
||
17 | url := "http://foo.bar/.." |
||
18 | FolderOf(url) |
||
19 | } |
||
20 | |||
21 | func TestFolderOfPanic2(t *testing.T) { |
||
22 | url := "http://foo.bar/../../../foobar" |
||
23 | u := FolderOf(url) |
||
24 | if filepath.Base(u) != "foobar" { |
||
25 | t.Fatalf("url of return incorrect value") |
||
26 | } |
||
27 | } |
||
28 | |||
29 | func TestFolderOfNormal(t *testing.T) { |
||
30 | url := "http://foo.bar/file" |
||
31 | u := FolderOf(url) |
||
32 | if filepath.Base(u) != "file" { |
||
33 | t.Fatalf("url of return incorrect value") |
||
34 | } |
||
35 | } |
||
36 | |||
37 | func TestFolderWithoutParams(t *testing.T) { |
||
38 | url := "http://foo.bar/file?param=value" |
||
39 | u := FolderOf(url) |
||
40 | if filepath.Base(u) != "file" { |
||
41 | t.Fatalf("url of return incorrect value") |
||
42 | } |
||
44 |