Skip to content

Commit 8da89d3

Browse files
committed
more mimetype testing
1 parent a837971 commit 8da89d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/src/odr_test.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
#include <odr/exceptions.hpp>
12
#include <odr/odr.hpp>
23

4+
#include <odr/internal/project_info.hpp>
5+
36
#include <test_util.hpp>
47

58
#include <gtest/gtest.h>
@@ -20,6 +23,9 @@ TEST(odr, types_odt) {
2023
EXPECT_EQ(types.size(), 2);
2124
EXPECT_EQ(types[0], FileType::zip);
2225
EXPECT_EQ(types[1], FileType::opendocument_text);
26+
27+
const auto mime = mimetype(path, *logger);
28+
EXPECT_EQ(mime, "application/vnd.oasis.opendocument.text");
2329
}
2430

2531
TEST(odr, types_wpd) {
@@ -30,4 +36,11 @@ TEST(odr, types_wpd) {
3036
const auto types = list_file_types(path, *logger);
3137
EXPECT_EQ(types.size(), 1);
3238
EXPECT_EQ(types[0], FileType::word_perfect);
39+
40+
if (project_info::has_libmagic()) {
41+
const auto mime = mimetype(path, *logger);
42+
EXPECT_EQ(mime, "application/vnd.wordperfect");
43+
} else {
44+
EXPECT_THROW(auto mime = mimetype(path, *logger), UnsupportedFileType);
45+
}
3346
}

0 commit comments

Comments
 (0)