This will be used in GtkFileFilter in the future. Tests included.
We have a well-working way to test internal apis now, lets use it for these tests.