Test more chain matching cases.
Code to make tests from d287f28 pass.