Add unit test from #3853