flatten: more tests, DRY