#!/bin/sh
# Regression lock for xmlLineNumbersDefault: 'xml val' reports the source line
# of a DTD validation error (the "file:line" prefix). On libxml2 >= 2.15 line
# numbers are always enabled, but on the pre-2.15 matrix they appear only
# because valMain (and foInitLibXml/xsltInitLibXml) call xmlLineNumbersDefault(1)
# - there is no XML_PARSE_* flag for this. See the v3-removal note on the commit
# that introduces this test. grep keeps it robust to the exact number/message.
./xmlstarlet val --err --dtd xml/lineno.dtd xml/lineno-invalid.xml 2>&1 \
    | grep -qE 'lineno-invalid\.xml:[0-9]+' && echo "line-number-reported" || echo "no-line-number"
