Add a regression test for #1152.

The test code is slightly changed in order not to depend on Array#map.