diff --git a/src/dom/test/test-dom-configuration-basic b/src/dom/test/test-dom-configuration-basic index cd217b1e..08381888 100755 --- a/src/dom/test/test-dom-configuration-basic +++ b/src/dom/test/test-dom-configuration-basic @@ -17,13 +17,7 @@ test_normalize_output_equals () { src="$1"; shift out="$1"; shift - URI="test:$(echo "$desc" | sed ' - s/^[ \t]*\[[^]]*\][ \t]*//; - s/[:., \t][:., \t]*/-/g; - s/_/-/g; - # *cough* - y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; - s/[^a-zA-Z0-9-]//g;')" + URI="test:$(normalize "$desc")" sgml-parser --src "$src" --normalize "$config" --uri "$URI" --src "$src" | sed 's/^ //' > output echo "#document: $URI" > expected diff --git a/src/dom/test/test-sgml-parser-basic b/src/dom/test/test-sgml-parser-basic index f19f158e..f81495e9 100755 --- a/src/dom/test/test-sgml-parser-basic +++ b/src/dom/test/test-sgml-parser-basic @@ -16,13 +16,7 @@ test_output_equals () { src="$1"; shift out="$1"; shift - URI="test:$(echo "$desc" | sed ' - s/^[ \t]*\[[^]]*\][ \t]*//; - s/[:., \t][:., \t]*/-/g; - s/_/-/g; - # *cough* - y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; - s/[^a-zA-Z0-9-]//g;')" + URI="test:$(normalize "$desc")" sgml-parser --uri "$URI" --src "$src" | sed 's/^ //' > output echo "#document: $URI" > expected diff --git a/src/dom/test/test-sgml-parser-incremental b/src/dom/test/test-sgml-parser-incremental index aa6ea64b..1e520d06 100755 --- a/src/dom/test/test-sgml-parser-incremental +++ b/src/dom/test/test-sgml-parser-incremental @@ -16,13 +16,7 @@ test_incremental_parsing () { src="$1"; shift out="$1"; shift - URI="test:$(echo "$desc" | sed ' - s/^[ \t]*\[[^]]*\][ \t]*//; - s/[:., \t][:., \t]*/-/g; - s/_/-/g; - # *cough* - y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; - s/[^a-zA-Z0-9-]//g;')" + URI="test:$(normalize "$desc")" echo "#document: $URI" > expected echo "$out" | sed -n '2,$p' >> expected diff --git a/test/libtest.sh b/test/libtest.sh index 12de5c92..a16e4577 100755 --- a/test/libtest.sh +++ b/test/libtest.sh @@ -15,7 +15,7 @@ export LANG LC_ALL PAGER TZ # test_description='Description of this test... # This test checks if command xyzzy does the right thing... # ' -# . ./test-lib.sh +# . "$TEST_LIB error () { echo "* error: $*" @@ -27,6 +27,17 @@ say () { echo "* $*" } +normalize () { + echo "$@" | sed ' + s/^[ \t]*\[[^]]*\][ \t]*//; + s/[:., \t][:., \t]*/-/g; + s/_/-/g; + # *cough* + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; + s/[^a-zA-Z0-9-]//g;' +} + + test "${test_description}" != "" || error "Test script did not set test_description."