test-lib.sh: move error line after error() declaration