Test cases from #364 added.

If you think it worth, then add it, or we can close #364 without it.