#!/bin/sh # # Copyright (c) 2005 Jonas Fonseca # test_description='Test the very basic parsing of SGML documents. This test runs very basic features, like checking that nodes are placed correctly in the DOM tree. ' . ./libtest test_output_equals () { desc="$1" src="$2" out="$3" URI="test:$(echo "$desc" | sed ' s/^[ \t]*\[[^]]*\][ \t]*//; s/[:., \t][:., \t]*/-/g; s/_/-/g; # *cough* y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; s/[^a-zA-Z0-9-]//g;')" sgml-parser --uri "$URI" --src "$src" | sed 's/^ //' > output echo "#document: $URI" > expected echo "$out" | sed -n '2,$p' >> expected test_expect_success "$desc" 'cmp -b output expected' } ################################################################ # Parse various SGML node types. test_output_equals \ 'Parse a small document.' \ '
Hello World!
' \ ' element: html element: body element: p #text: Hello World!' test_output_equals \ 'Parse an enclosed comment.' \ '