Also see the tests in #942.  Maybe pull the relevant ones from there into this PR.