Add a test for the RESULT_EXPAND case.
Implement the case, and fix a bug in expandUrl().