diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-05-24 13:22:59 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-05-24 13:22:59 +0300 |
commit | 6c5368b2501d321189f51200df9ef7619187070c (patch) | |
tree | c72ff67082152e539fcf4512cdabb34393e2b003 /fs_test.go | |
parent | Issue #100: accept POST query args with arbitrary charset set via Content-Type (diff) | |
download | fasthttp-6c5368b2501d321189f51200df9ef7619187070c.tar.gz fasthttp-6c5368b2501d321189f51200df9ef7619187070c.tar.bz2 fasthttp-6c5368b2501d321189f51200df9ef7619187070c.zip |
Issue #103: Added FS.CompressedFileSuffix and clarified FSHandlerCacheDuration documentation
Diffstat (limited to 'fs_test.go')
-rw-r--r-- | fs_test.go | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -565,21 +565,21 @@ func testStripPathSlashes(t *testing.T, path string, stripSlashes int, expectedP } func TestFileExtension(t *testing.T) { - testFileExtension(t, "foo.bar", false, ".bar") - testFileExtension(t, "foobar", false, "") - testFileExtension(t, "foo.bar.baz", false, ".baz") - testFileExtension(t, "", false, "") - testFileExtension(t, "/a/b/c.d/efg.jpg", false, ".jpg") - - testFileExtension(t, "foo.bar", true, ".bar") - testFileExtension(t, "foobar.fasthttp.gz", true, "") - testFileExtension(t, "foo.bar.baz.fasthttp.gz", true, ".baz") - testFileExtension(t, "", true, "") - testFileExtension(t, "/a/b/c.d/efg.jpg.fasthttp.gz", true, ".jpg") + testFileExtension(t, "foo.bar", false, "zzz", ".bar") + testFileExtension(t, "foobar", false, "zzz", "") + testFileExtension(t, "foo.bar.baz", false, "zzz", ".baz") + testFileExtension(t, "", false, "zzz", "") + testFileExtension(t, "/a/b/c.d/efg.jpg", false, ".zzz", ".jpg") + + testFileExtension(t, "foo.bar", true, ".zzz", ".bar") + testFileExtension(t, "foobar.zzz", true, ".zzz", "") + testFileExtension(t, "foo.bar.baz.fasthttp.gz", true, ".fasthttp.gz", ".baz") + testFileExtension(t, "", true, ".zzz", "") + testFileExtension(t, "/a/b/c.d/efg.jpg.xxx", true, ".xxx", ".jpg") } -func testFileExtension(t *testing.T, path string, compressed bool, expectedExt string) { - ext := fileExtension(path, compressed) +func testFileExtension(t *testing.T, path string, compressed bool, compressedFileSuffix, expectedExt string) { + ext := fileExtension(path, compressed, compressedFileSuffix) if ext != expectedExt { t.Fatalf("unexpected file extension for file %q: %q. Expecting %q", path, ext, expectedExt) } |