mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
165 lines
2.6 KiB
Bash
Executable File
165 lines
2.6 KiB
Bash
Executable File
#!/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...'
|
|
|
|
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: '..."
|
|
|
|
test_done
|