mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Move test for incompleteness to own file
This commit is contained in:
parent
7ff2cb2607
commit
dee8ac5b45
@ -31,23 +31,6 @@ test_output_equals () {
|
|||||||
test_expect_success "$desc" 'cmp output expected'
|
test_expect_success "$desc" 'cmp output expected'
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_incomplete () {
|
|
||||||
desc="$1"; shift
|
|
||||||
src="$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;')"
|
|
||||||
|
|
||||||
sgml-parser --uri "$URI" --src "$src" --incomplete >/dev/null
|
|
||||||
test_expect_success "$desc" \
|
|
||||||
"test $? = 1"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Parse various SGML node types.
|
# Parse various SGML node types.
|
||||||
@ -300,85 +283,5 @@ test_output_equals \
|
|||||||
'
|
'
|
||||||
8' \
|
8' \
|
||||||
--print-lines
|
--print-lines
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete comment. (I)' \
|
|
||||||
'<!-'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete comment. (II)' \
|
|
||||||
'<!-- ... '
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete notation. (I)' \
|
|
||||||
'<!'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete notation. (II)' \
|
|
||||||
'<!D'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete cdata section. (I)' \
|
|
||||||
'<![CDATA[ ... '
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete cdata section. (II)' \
|
|
||||||
'<![CDAT'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete element. (I)' \
|
|
||||||
'<elem...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete element. (II)' \
|
|
||||||
'<'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete element end. (I)' \
|
|
||||||
'<a></a'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete element end. (II)' \
|
|
||||||
'<a></'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete attribute.' \
|
|
||||||
'<element attr...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete attribute value.' \
|
|
||||||
'<element attr=...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete attribute quoted value. (I)' \
|
|
||||||
'<element attr="...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete attribute quoted value. (II)' \
|
|
||||||
"<element attr='..."
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete processing instruction. (I)' \
|
|
||||||
'<?xml'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete processing instruction. (II)' \
|
|
||||||
'<?xml attr...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete notation.' \
|
|
||||||
'<!DOCTYPE html PUBLIC ...'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete reference. (I)' \
|
|
||||||
'�'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete reference. (II)' \
|
|
||||||
'&'
|
|
||||||
|
|
||||||
test_expect_incomplete \
|
|
||||||
'Check incomplete text.' \
|
|
||||||
'plain text is always incomplete (if incomplete)'
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
115
src/dom/test/test-sgml-parser-incomplete
Executable file
115
src/dom/test/test-sgml-parser-incomplete
Executable file
@ -0,0 +1,115 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005 Jonas Fonseca
|
||||||
|
#
|
||||||
|
|
||||||
|
test_description='Test that incompleteness is correctly detected
|
||||||
|
|
||||||
|
This test checks that the SGML parser correctly finds and reports
|
||||||
|
when a part of the source is incomplete.
|
||||||
|
'
|
||||||
|
|
||||||
|
. "$TEST_LIB"
|
||||||
|
|
||||||
|
test_expect_incomplete () {
|
||||||
|
desc="$1"; shift
|
||||||
|
src="$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;')"
|
||||||
|
|
||||||
|
sgml-parser --uri "$URI" --src "$src" --incomplete >/dev/null
|
||||||
|
test_expect_success "$desc" \
|
||||||
|
"test $? = 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Check for incompleteness
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete comment. (I)' \
|
||||||
|
'<!-'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete comment. (II)' \
|
||||||
|
'<!-- ... '
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete notation. (I)' \
|
||||||
|
'<!'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete notation. (II)' \
|
||||||
|
'<!D'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete cdata section. (I)' \
|
||||||
|
'<![CDATA[ ... '
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete cdata section. (II)' \
|
||||||
|
'<![CDAT'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete element. (I)' \
|
||||||
|
'<elem...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete element. (II)' \
|
||||||
|
'<'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete element end. (I)' \
|
||||||
|
'<a></a'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete element end. (II)' \
|
||||||
|
'<a></'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete attribute.' \
|
||||||
|
'<element attr...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete attribute value.' \
|
||||||
|
'<element attr=...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete attribute quoted value. (I)' \
|
||||||
|
'<element attr="...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete attribute quoted value. (II)' \
|
||||||
|
"<element attr='..."
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete processing instruction. (I)' \
|
||||||
|
'<?xml'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete processing instruction. (II)' \
|
||||||
|
'<?xml attr...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete notation.' \
|
||||||
|
'<!DOCTYPE html PUBLIC ...'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete reference. (I)' \
|
||||||
|
'�'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete reference. (II)' \
|
||||||
|
'&'
|
||||||
|
|
||||||
|
test_expect_incomplete \
|
||||||
|
'Check incomplete text.' \
|
||||||
|
'plain text is always incomplete (if incomplete)'
|
||||||
|
|
||||||
|
test_done
|
Loading…
x
Reference in New Issue
Block a user