fileserver: Fix newly-introduced failing test on Linux (#3625)

* 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.
This commit is contained in:
Matt Holt 2020-08-01 12:43:30 -06:00 committed by GitHub
parent af5c148ed1
commit c054a818a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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",
@ -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)
}
}