From 2849382d9c1bb385897649123f6500400e7240cc Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Mon, 22 Aug 2022 19:53:41 -0700 Subject: [PATCH] Add MapContentType tests --- test/tool/net/lua_test.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/tool/net/lua_test.lua b/test/tool/net/lua_test.lua index d3a25cf42..e687b4e8a 100644 --- a/test/tool/net/lua_test.lua +++ b/test/tool/net/lua_test.lua @@ -21,3 +21,12 @@ assert(0200 == 128) assert("\e" == "\x1b") assert("hi" * 3 == "hihihi") assert("hello %d" % {123} == "hello 123") + +-- test MapContentType +assert(MapContentType("txt") == "text/plain") +assert(MapContentType("htm") == "text/html") +assert(MapContentType("abc.htm") == "text/html") +assert(MapContentType("1") == nil) +MapContentType("1", "text/x-foo") +assert(MapContentType("1"), "text/x-foo") +assert(MapContentType("file.1"), "text/x-foo")