summaryrefslogtreecommitdiff
path: root/tests/mime-detection/import-objc.m
diff options
context:
space:
mode:
authorIgor Kushnir <igorkuo@gmail.com>2021-10-10 12:29:14 +0300
committerDavid Faure <faure@kde.org>2021-12-12 18:48:29 +0000
commit8feb299b037c48a1a67697ba868ccc939a851ba0 (patch)
tree7a6e9cfd7d22674fce35f79178ec0ef8d85bfdcb /tests/mime-detection/import-objc.m
parent7d10eb97ad94f500a577a5a516a1ffc1a9fb0805 (diff)
downloadshared-mime-info-8feb299b037c48a1a67697ba868ccc939a851ba0.tar.gz
text/x-objc++src: new type
This MIME type name is used in Qt Creator [1] and KDevelop [2]. A different name - text/x-objcpp-src - is used in KSyntaxHighlighting [3]. The name text/x-objc++src is consistent with the existing MIME type names text/x-c++src and text/x-objcsrc. So KSyntaxHighlighting's name will have to be replaced later. The Objective-C Wikipedia article and the KSyntaxHighlighting's data file [3] claim that *.M is one of the file extensions of Objective-C++ source files. But since macOS's file system is case-insensitive by default, *.mm is used almost universally. Thus there is no need to complicate the MIME type database with case-sensitive attributes. Make text/x-troff-mm a subclass of text/troff to reuse its magic element. As far as I can tell, these two file formats share the same comment syntax, which is encoded in text/troff's magic. Add Objective-C, Objective-C++, Troff, Troff MM and C tests to verify correct detection of the new MIME type and the absence of regressions. [1] https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/cppeditor/CppEditor.json.in?id=2cc28dea65846153d16c213283ffac7af530590d#n100 [2] https://invent.kde.org/kdevelop/kdevelop/-/blob/ebd207cca2387b5734a591803381880505e39a30/plugins/astyle/astyle_plugin.cpp#L284 [3] https://invent.kde.org/frameworks/syntax-highlighting/-/blob/0b2c0dc5368de519c4e9517a4dec69017df4cd6c/data/syntax/objectivecpp.xml#L3
Diffstat (limited to 'tests/mime-detection/import-objc.m')
-rw-r--r--tests/mime-detection/import-objc.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/mime-detection/import-objc.m b/tests/mime-detection/import-objc.m
new file mode 100644
index 00000000..ae0e0e34
--- /dev/null
+++ b/tests/mime-detection/import-objc.m
@@ -0,0 +1,8 @@
+#import <stdio.h>
+
+int main(int argc, const char *argv[])
+{
+ printf("Hello, world!\n");
+ return 0;
+}
+