sudo_getgrouplist2() is just a wrapper on such systems and this avoids a test failure on macOS where a user is automatically a member of certain groups.