(cherry picked from commit a4a07ba996)
a4a07ba996
Also add a basic test case. (cherry picked from commit 284b8d94d4)
284b8d94d4