Unit test for #37

Based on @DavidRSchaller repro case. It passes, however, so maybe this is a platform-dependent bug?