Match test lines by proximity, closes #2450