Do not insert terminating delimiter if already exist.

Signed-off-by: Yen-Chin Lee <coldnew.tw@gmail.com>
Add testcase to makesure no double terminating delimiter be insetred.

Signed-off-by: Yen-Chin Lee <coldnew.tw@gmail.com>
Merge pull request #5 from coldnew/master

Do not insert terminating delimiter if already exist.