[misc] Improve test.

(cherry picked from commit 95ab933de20090c87a0dfb7c326d5e7290c14bad)