Fix our tests for older GLib

Turns out that g_assert_null is only available in GLib >= 2.38,
g_assert_nonnull in GLib >= 2.40 and g_assert_true in GLib >= 2.38.

Using #if checks here would be pretty ugly though, so let's find another
way.

Turns out, there's even better!