mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
17a76257f8
Works with both bash and dash. This reintroduces the fix to the test-sgml-parser-basic test, and also fixes test-sgml-parser-incremental and test-sgml-parser-lines, which Witek has reported as failing.
65 lines
957 B
Bash
Executable File
65 lines
957 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2005 Jonas Fonseca
|
|
#
|
|
|
|
test_description='Test the SGML parsers counting of lines
|
|
|
|
Checks that the SGML parser correctly reports how many lines the
|
|
source has.
|
|
'
|
|
|
|
. "$TEST_LIB"
|
|
|
|
test_output_line_numbers () {
|
|
desc="$1"; shift
|
|
src="$1"; shift
|
|
expected_lines="$1"; shift
|
|
|
|
lines=$(sgml-parser --src "$src" --print-lines)
|
|
|
|
test_expect_success "$desc" "test $lines = $expected_lines"
|
|
}
|
|
|
|
|
|
################################################################
|
|
# Check line numbers
|
|
|
|
test_output_line_numbers \
|
|
'Check line numbers. (I)' \
|
|
'<!-- line --> number <one />' \
|
|
1
|
|
|
|
test_output_line_numbers \
|
|
'Check line numbers. (II)' \
|
|
'<
|
|
line:2
|
|
line:3
|
|
=
|
|
"line:5"
|
|
><?xml
|
|
line:7="..."
|
|
line:8
|
|
=
|
|
'\''...'\''></line:10>' \
|
|
10
|
|
|
|
test_output_line_numbers \
|
|
'Check line numbers. (III)' \
|
|
'1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8' \
|
|
8
|
|
|
|
test_output_line_numbers \
|
|
'Check line numbers. (IIII)' \
|
|
"$(printf "1\r\f 2\v\n 3\r\n 4\t\f 5")" \
|
|
5
|
|
|
|
test_done
|