summaryrefslogtreecommitdiffhomepage
path: root/tests/test-mime.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-05 13:55:20 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-05 13:55:20 +0100
commit7973293c311e27ff08a1488c9759c1b5b0fda30e (patch)
treeb4c622de1af43979ba1779713398bbcb6e52be31 /tests/test-mime.cpp
parent0f2ac0c4311e4429bfa4ede1d96ce467b5dceb5b (diff)
Added tests
Diffstat (limited to 'tests/test-mime.cpp')
-rw-r--r--tests/test-mime.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/test-mime.cpp b/tests/test-mime.cpp
index 2d28a36..f3ca8ee 100644
--- a/tests/test-mime.cpp
+++ b/tests/test-mime.cpp
@@ -1,6 +1,6 @@
#include <gtest/gtest.h>
-#include "file.h"
+#include "mime.h"
class MimeTest: public ::testing::Test
{
@@ -21,3 +21,32 @@ protected:
};
+TEST_F(MimeTest, mime_type)
+{
+ EXPECT_EQ(Reichwein::Mime::mime_type(""), "");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.html"), "text/html");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.htm"), "text/html");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.html"), "text/html");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.php"), "text/html");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.css"), "text/css");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.txt"), "text/plain");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.js"), "application/javascript");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.json"), "application/json");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.xml"), "application/xml");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.swf"), "application/x-shockwave-flash");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.flv"), "video/x-flv");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.png"), "image/png");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpe"), "image/jpeg");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpeg"), "image/jpeg");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpg"), "image/jpeg");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.gif"), "image/gif");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.bmp"), "image/bmp");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.ico"), "image/vnd.microsoft.icon");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.tiff"), "image/tiff");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.tif"), "image/tiff");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.svg"), "image/svg+xml");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.svgz"), "image/svg+xml");
+ EXPECT_EQ(Reichwein::Mime::mime_type("a/bcd.cpp"), "application/text");
+ EXPECT_EQ(Reichwein::Mime::mime_type("bla.HTML"), "text/html");
+}
+