diff --git a/source/mime/database.d b/source/mime/database.d
index ac680ba..0267dff 100644
--- a/source/mime/database.d
+++ b/source/mime/database.d
@@ -359,7 +359,17 @@ unittest
//testing literal
assert(database.mimeTypeForFileName("liblist.gam"));
- assert(database.mimeTypeForFileName("GNUmakefile"));
+ assert(database.mimeTypeForFileName("makefile"));
+
+ //testing discard glob
+ assert(!database.mimeTypeForFileName("GNUmakefile"));
+ assert(!database.detector.mimeTypeForFileName("GNUmakefile"));
+
+ assert(!database.mimeTypeForFileName("file.qvm3"));
+ assert(!database.detector.mimeTypeForFileName("file.qvm3"));
+
+ assert(!database.mimeTypeForFileName("model01.sequence"));
+ assert(!database.detector.mimeTypeForFileName("model01.sequence"));
//testing discard magic
assert(!database.mimeTypeForData("PAK"));
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..697ae90
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1 @@
+update-mime-database
diff --git a/test/discard/generic-icons b/test/discard/generic-icons
index e69de29..d680896 100644
--- a/test/discard/generic-icons
+++ b/test/discard/generic-icons
@@ -0,0 +1 @@
+application/x-hlmdl-sequence:application-x-hlmdl
diff --git a/test/discard/globs b/test/discard/globs
index 063dc47..7a119f6 100644
--- a/test/discard/globs
+++ b/test/discard/globs
@@ -1,4 +1,7 @@
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
-text/x-gnumakefile:gnumakefile
+application/x-hlmdl-sequence:**[0123456789][0123456789].sequence
+text/x-makefile:gnumakefile
application/java-multimedia-file:*.jmf
+text/x-othermakefile:makefile
+application/x-qvm:*.qvm3
diff --git a/test/discard/globs2 b/test/discard/globs2
index c617b2d..ad56ece 100644
--- a/test/discard/globs2
+++ b/test/discard/globs2
@@ -1,4 +1,7 @@
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
-50:text/x-gnumakefile:gnumakefile
+50:application/x-hlmdl-sequence:**[0123456789][0123456789].sequence
+50:text/x-makefile:gnumakefile
50:application/java-multimedia-file:*.jmf
+50:text/x-othermakefile:makefile
+50:application/x-qvm:*.qvm3
diff --git a/test/discard/mime.cache b/test/discard/mime.cache
index da214b6..ecf4dea 100644
Binary files a/test/discard/mime.cache and b/test/discard/mime.cache differ
diff --git a/test/discard/packages/discard.xml b/test/discard/packages/discard.xml
index 9060f76..95e28f1 100644
--- a/test/discard/packages/discard.xml
+++ b/test/discard/packages/discard.xml
@@ -10,7 +10,12 @@
Java multimedia file
-
+
+ Makefile
+
+
+
+
Makefile
@@ -27,4 +32,13 @@
+
+ Half-Life model sequence
+
+
+
+
+ Quake III virtual machine bytecode
+
+
diff --git a/test/discard/subclasses b/test/discard/subclasses
index 2507197..ed88348 100644
--- a/test/discard/subclasses
+++ b/test/discard/subclasses
@@ -1 +1,2 @@
-text/x-gnumakefile text/plain
+text/x-othermakefile text/plain
+text/x-makefile text/plain
diff --git a/test/discard/types b/test/discard/types
index 240ca92..52d4e05 100644
--- a/test/discard/types
+++ b/test/discard/types
@@ -1,5 +1,8 @@
application/java-multimedia-file
+application/x-hlmdl-sequence
application/x-otherpak
application/x-pak
+application/x-qvm
image/x-somesprite
-text/x-gnumakefile
+text/x-makefile
+text/x-othermakefile
diff --git a/test/discard/version b/test/discard/version
index 7e32cd5..810ee4e 100644
--- a/test/discard/version
+++ b/test/discard/version
@@ -1 +1 @@
-1.3
+1.6
diff --git a/test/mime/globs b/test/mime/globs
index 0bcf671..8fcb1c2 100644
--- a/test/mime/globs
+++ b/test/mime/globs
@@ -1,16 +1,19 @@
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
+text/x-makefile:__NOGLOBS__
+application/x-hlmdl-sequence:__NOGLOBS__
+application/x-qvm:__NOGLOBS__
image/x-sprite32:*.spr32
-application/x-pak:pak*.pak
application/x-iqm:*.iqm
text/x-q3shader:*.shader
-application/x-general-long-glob:general*_long_glob
image/x-sprite32:*.sp2
image/x-q2sprite:*.sp2
+application/x-general-long-glob:general*_long_glob
image/x-qsprite:*.spr
image/x-sprite32:*.spr
image/x-hlsprite:*.spr
text/x-ent:*.ent
+application/x-pak:pak*.pak
application/x-wad:*.wad
application/x-wad2:*.wad
application/x-wad3:*.wad
@@ -28,15 +31,14 @@ application/x-mdl:*.mdl
application/x-rmf:*.rmf
application/x-md2:*.md2
application/x-md3:*.md3
-application/x-md4:*.md4
application/x-lmp:*.lmp
+application/x-md4:*.md4
application/x-qvm:*.qvm
text/x-liblist:liblist.gam
application/x-jmf:*.jmf
-image/x-vtf:*.vtf
application/x-gcf:*.gcf
+image/x-vtf:*.vtf
text/x-qcsrc:*.qc
-text/x-makefile:gnumakefile
text/x-qchdr:*.qh
application/x-general-glob:general*glob
application/x-vmf:*.vmf
diff --git a/test/mime/globs2 b/test/mime/globs2
index f561db6..3982eb7 100644
--- a/test/mime/globs2
+++ b/test/mime/globs2
@@ -1,18 +1,21 @@
# This file was automatically generated by the
# update-mime-database command. DO NOT EDIT!
+0:text/x-makefile:__NOGLOBS__
+0:application/x-hlmdl-sequence:__NOGLOBS__
+0:application/x-qvm:__NOGLOBS__
50:image/x-sprite32:*.spr32
-50:application/x-pak:pak*.pak:cs
-50:application/x-pak:pak*.pak
50:application/x-iqm:*.iqm
50:text/x-q3shader:*.shader:cs
50:text/x-q3shader:*.shader
-50:application/x-general-long-glob:general*_long_glob
50:image/x-sprite32:*.sp2
50:image/x-q2sprite:*.sp2
+50:application/x-general-long-glob:general*_long_glob
50:image/x-qsprite:*.spr
50:image/x-sprite32:*.spr
50:image/x-hlsprite:*.spr
50:text/x-ent:*.ent
+50:application/x-pak:pak*.pak:cs
+50:application/x-pak:pak*.pak
50:application/x-wad:*.wad
50:application/x-wad2:*.wad
50:application/x-wad3:*.wad
@@ -30,15 +33,14 @@
50:application/x-rmf:*.rmf
50:application/x-md2:*.md2
50:application/x-md3:*.md3
-50:application/x-md4:*.md4
50:application/x-lmp:*.lmp
+50:application/x-md4:*.md4
50:application/x-qvm:*.qvm
50:text/x-liblist:liblist.gam
50:application/x-jmf:*.jmf
-50:image/x-vtf:*.vtf
50:application/x-gcf:*.gcf
+50:image/x-vtf:*.vtf
50:text/x-qcsrc:*.qc
-50:text/x-makefile:gnumakefile
50:text/x-qchdr:*.qh
50:application/x-general-glob:general*glob
50:application/x-vmf:*.vmf
diff --git a/test/mime/mime.cache b/test/mime/mime.cache
index 4e3dc40..0ee1214 100644
Binary files a/test/mime/mime.cache and b/test/mime/mime.cache differ
diff --git a/test/mime/packages/base.xml b/test/mime/packages/base.xml
index f87b782..4d1856c 100644
--- a/test/mime/packages/base.xml
+++ b/test/mime/packages/base.xml
@@ -16,7 +16,7 @@
Makefile
-
+
digital photos
diff --git a/test/mime/packages/quake-hl.xml b/test/mime/packages/quake-hl.xml
index 046a90a..b68d7e9 100644
--- a/test/mime/packages/quake-hl.xml
+++ b/test/mime/packages/quake-hl.xml
@@ -207,6 +207,7 @@
+
@@ -315,6 +316,7 @@
+
diff --git a/test/mime/version b/test/mime/version
index 7e32cd5..810ee4e 100644
--- a/test/mime/version
+++ b/test/mime/version
@@ -1 +1 @@
-1.3
+1.6
diff --git a/test/note.txt b/test/note.txt
new file mode 100644
index 0000000..b4a35cb
--- /dev/null
+++ b/test/note.txt
@@ -0,0 +1,3 @@
+update-mime-database from shared-mime-info 1.6 has bugs with writing the number of literal and glob patterns.
+These tests use patched version to make 100% coverage of mime/detectors/cache.d possible.
+Patch is provided as update-mime-database.c.patch file.
diff --git a/test/update-mime-database.c.patch b/test/update-mime-database.c.patch
new file mode 100644
index 0000000..879c786
--- /dev/null
+++ b/test/update-mime-database.c.patch
@@ -0,0 +1,42 @@
+2372a2373,2396
+> typedef struct
+> {
+> GetValueFunc *get_value;
+> gpointer data;
+> guint count;
+>
+> } CountData;
+>
+> static void
+> count_map_entry (gpointer key,
+> gpointer data)
+> {
+> CountData *count_data = (CountData *)data;
+> gchar **values;
+>
+> values = (* count_data->get_value) (count_data->data, key);
+> count_data->count += g_strv_length (values) / 3;
+> g_strfreev (values);
+> }
+>
+> static gchar **
+> get_glob_list_value (gpointer data,
+> gchar *key);
+>
+2384a2409,2410
+> CountData count_data;
+> guint count;
+2394c2420,2430
+< if (!write_card32 (cache, keys->len))
+---
+> if (get_value == &get_glob_list_value) {
+> count_data.count = 0;
+> count_data.data = map;
+> count_data.get_value = get_value;
+> g_ptr_array_foreach (keys, count_map_entry, &count_data);
+> count = count_data.count;
+> } else {
+> count = keys->len;
+> }
+>
+> if (!write_card32 (cache, count))
diff --git a/test/update.sh b/test/update.sh
index f302d41..98cd04d 100755
--- a/test/update.sh
+++ b/test/update.sh
@@ -1,5 +1,5 @@
DIRNAME=$(dirname -- $(readlink -f -- $0))
export XDG_DATA_HOME=$DIRNAME
-update-mime-database $DIRNAME/mime
-update-mime-database $DIRNAME/discard
+$DIRNAME/update-mime-database $DIRNAME/mime
+$DIRNAME/update-mime-database $DIRNAME/discard