mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Add a test file for checking detection of errors by the SGML parser
This commit is contained in:
parent
03ee543e21
commit
97f403a9d9
166
src/dom/test/test-sgml-parser-error
Executable file
166
src/dom/test/test-sgml-parser-error
Executable file
@ -0,0 +1,166 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2005 Jonas Fonseca
|
||||
#
|
||||
|
||||
test_description='Test SGML parser error reporting
|
||||
|
||||
This test checks that the SGML parser will report errors in the source
|
||||
given to it.
|
||||
'
|
||||
|
||||
. "$TEST_LIB"
|
||||
|
||||
test_output_error () {
|
||||
desc="$1"; shift
|
||||
src="$1"; shift
|
||||
out="$1"; shift
|
||||
|
||||
sgml-parser --src "$src" --error > output
|
||||
echo "$out" | sed -n '2,$p' > expected
|
||||
|
||||
test_expect_success "$desc" 'cmp output expected'
|
||||
}
|
||||
|
||||
|
||||
################################################################
|
||||
# Check parsing errors
|
||||
|
||||
test_output_error \
|
||||
'Check an element error.' \
|
||||
'<html' \
|
||||
'
|
||||
error on line 1: <html'
|
||||
|
||||
test_output_error \
|
||||
'Check an entity reference error.' \
|
||||
'a
|
||||
b
|
||||
&c' \
|
||||
'
|
||||
error on line 3: &c'
|
||||
|
||||
test_output_error \
|
||||
'Check multiple entity reference errors.' \
|
||||
'a
|
||||
&b&
|
||||
c
|
||||
&d' \
|
||||
'
|
||||
error on line 2: &b
|
||||
error on line 4: &d'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete comment. (I)' \
|
||||
'<!-' \
|
||||
'
|
||||
error on line 1: <!-'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete comment. (II)' \
|
||||
'<!-- ... ' \
|
||||
"
|
||||
error on line 1: <!--"
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete notation. (I)' \
|
||||
'<!' \
|
||||
'
|
||||
error on line 1: <!'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete notation. (II)' \
|
||||
'<!DOCTYPE ...' \
|
||||
'
|
||||
error on line 1: <!DOCTYPE'
|
||||
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete cdata section. (I)' \
|
||||
'<![CDATA[ ... ' \
|
||||
'
|
||||
error on line 1: <![CDATA['
|
||||
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete cdata section. (II)' \
|
||||
'<![CDAT' \
|
||||
'
|
||||
error on line 1: <![CDAT'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete processing instruction. (I)' \
|
||||
'<?xml ' \
|
||||
'
|
||||
error on line 1: <?xml'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete processing instruction. (II)' \
|
||||
'<?xml-stylesheet attr...' \
|
||||
'
|
||||
error on line 1: attr...'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete reference. (I)' \
|
||||
'�' \
|
||||
'
|
||||
error on line 1: �'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete reference. (II)' \
|
||||
'&' \
|
||||
'
|
||||
error on line 1: &'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete element. (I)' \
|
||||
'<elem...' \
|
||||
'
|
||||
error on line 1: <elem...'
|
||||
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete element. (II)' \
|
||||
'<' \
|
||||
'
|
||||
error on line 1: <'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete element end. (I)' \
|
||||
'<a></a' \
|
||||
'
|
||||
error on line 1: </a'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete element end. (II)' \
|
||||
'<a></' \
|
||||
'
|
||||
error on line 1: </'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete attribute.' \
|
||||
'<element attr...' \
|
||||
'
|
||||
error on line 1: attr...'
|
||||
|
||||
cat >/dev/null <<FIXME
|
||||
test_output_error \
|
||||
'Check incomplete attribute value.' \
|
||||
'<element attr=...' \
|
||||
'
|
||||
error on line 1: ...'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete attribute quoted value. (I)' \
|
||||
'<element attr="...' \
|
||||
'
|
||||
error on line 1: "...'
|
||||
|
||||
test_output_error \
|
||||
'Check incomplete attribute quoted value. (II)' \
|
||||
"<element attr='..." \
|
||||
"
|
||||
error on line 1: '..."
|
||||
FIXME
|
||||
|
||||
test_done
|
Loading…
Reference in New Issue
Block a user