This is a follow-up to #6201, where I forgot to ask for tests. Either I'll do it (eventually), or someone else is faster. Ping @m-haisham?