I'd be grateful if you could explain the expected result for the tests substitution-003, 010, 011, 030.
I have added explanations of the rationale to the tests themselves.
In the case of -030 the outcome depends on bug 19425, and I need to give it further thought - I'm not sure the current expected result is correct. The test case was written to expose the question, not to provide the answer.
Thanks. The descriptions are very helpful.