internal/v4: refactor tests

We create a table with an entry for each kind of metadata so
that it's easy to add new entries and new tests that
test the metadata in arbitrary configurations without
writing reams of duplicated test code.

We also fix router so that it works correctly with
typed nil data, which avoids an if statement in
every metadata handler.
Maps, pointers and slices can all be nil. Other types cannot (and will cause the IsNil method to panic
when called), so we return false for those types.