add test code for issue18

Thank you for marging my pull request.
I tried to add test code for the issue.