Tests for correct handling of zero-length groups

Per @hadley request in issue #341.