textproc: refactor test utilities