Skip to content

Commit

Permalink
fileserver: Fix newly-introduced failing test on Linux (#3625)
Browse files Browse the repository at this point in the history
* fileserver: First attempt to fix failing test on Linux

I think I updated the wrong test case before

* Make new test function

I guess what we really are trying to test is the case insensitivity of
firstSplit. So a new test function is better for that.
  • Loading branch information
mholt committed Aug 1, 2020
1 parent af5c148 commit c054a81
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions modules/caddyhttp/fileserver/matcher_test.go
Expand Up @@ -71,11 +71,6 @@ func TestPHPFileMatcher(t *testing.T) {
expectedPath: "/foo.php.php/index.php",
matched: true,
},
{
path: "/foo.php.PHP/index.php",
expectedPath: "/foo.php.PHP/index.php",
matched: true,
},
{
// See https://github.com/caddyserver/caddy/issues/3623
path: "/%E2%C3",
Expand Down Expand Up @@ -115,3 +110,12 @@ func TestPHPFileMatcher(t *testing.T) {
}
}
}

func TestFirstSplit(t *testing.T) {
m := MatchFile{SplitPath: []string{".php"}}
actual := m.firstSplit("index.PHP/somewhere")
expected := "index.PHP"
if actual != expected {
t.Errorf("Expected %s but got %s", expected, actual)
}
}

0 comments on commit c054a81

Please sign in to comment.