unit test for #2815, as requested by @brendandburns
fixed minor formatting
Merge pull request #2831 from jdef/unit_test_for_2815

unit test for #2815, as requested by @brendandburns