tests/parsetext: factor out event printing