Merge in tests from r3887.