1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

[tests] added dom tests, some of them fail

This commit is contained in:
Witold Filipczyk 2022-10-05 19:43:27 +02:00
parent 92e9ab116a
commit 0b8230863d
6 changed files with 63 additions and 4 deletions

View File

@ -1,5 +1,4 @@
#SUBDIRS = css sgml test
subdir('css') subdir('css')
subdir('sgml') subdir('sgml')
srcs += files('configuration.c', 'node.c', 'select.c', 'stack.c', 'scanner.c') srcs += files('configuration.c', 'node.c', 'select.c', 'stack.c', 'scanner.c')
#SUBDIRS-$(CONFIG_DEBUG) += test subdir('test')

View File

@ -133,9 +133,7 @@ init_dom_scanner_info(struct dom_scanner_info *scanner_info)
if (info[i].type == DOM_SCAN_RANGE) { if (info[i].type == DOM_SCAN_RANGE) {
int index = *data->string; int index = *data->string;
assert(index > 0);
assert(data->length < DOM_SCAN_TABLE_SIZE); assert(data->length < DOM_SCAN_TABLE_SIZE);
assert(index <= data->length);
for (; index <= data->length; index++) for (; index <= data->length; index++)
scan_table[index] |= info[i].bits; scan_table[index] |= info[i].bits;

View File

@ -41,6 +41,13 @@
#define MAXTAGS 80 #define MAXTAGS 80
#define MAXPARS 20 #define MAXPARS 20
/* fake tty get function, needed for charsets.c */
int
get_ctl_handle()
{
return -1;
}
/* Tag and parameter list: guesstimating / reference compilation. */ /* Tag and parameter list: guesstimating / reference compilation. */
static char* tags[MAXTAGS][MAXPARS] = { static char* tags[MAXTAGS][MAXPARS] = {
{ "A", "NAME", "HREF", "REF", "REV", "TITLE", "TARGET", "SHAPE", "onLoad", "STYLE", 0 }, { "A", "NAME", "HREF", "REF", "REV", "TITLE", "TARGET", "SHAPE", "onLoad", "STYLE", 0 },

48
src/dom/test/meson.build Normal file
View File

@ -0,0 +1,48 @@
executable('html-mangle', 'html-mangle.c',
meson.source_root()+'/src/dom/configuration.c',
meson.source_root()+'/src/dom/node.c',
meson.source_root()+'/src/dom/select.c',
meson.source_root()+'/src/dom/stack.c',
meson.source_root()+'/src/dom/scanner.c',
meson.source_root()+'/src/dom/css/scanner.c',
testdeps,
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.', '../..', '../../..'])
executable('sgml-parser', 'sgml-parser.c',
meson.source_root()+'/src/dom/configuration.c',
meson.source_root()+'/src/dom/node.c',
meson.source_root()+'/src/dom/select.c',
meson.source_root()+'/src/dom/stack.c',
meson.source_root()+'/src/dom/scanner.c',
meson.source_root()+'/src/dom/css/scanner.c',
meson.source_root()+'/src/dom/sgml/dump.c',
meson.source_root()+'/src/dom/sgml/parser.c',
meson.source_root()+'/src/dom/sgml/scanner.c',
meson.source_root()+'/src/dom/sgml/sgml.c',
meson.source_root()+'/src/dom/sgml/docbook/docbook.c',
meson.source_root()+'/src/dom/sgml/html/html.c',
meson.source_root()+'/src/dom/sgml/rss/rss.c',
meson.source_root()+'/src/dom/sgml/xbel/xbel.c',
testdeps,
c_args:['-DHAVE_CONFIG_H'], cpp_args:['-DHAVE_CONFIG_H'], include_directories:['.', '../..', '../../..'])
test_lib = environment({'TEST_LIB': meson.source_root()+'/test/libtest.sh'})
t1 = find_program('test-dom-configuration-basic')
t2 = find_program('test-sgml-dump-basic')
t3 = find_program('test-sgml-parser-basic')
t4 = find_program('test-sgml-parser-error')
t5 = find_program('test-sgml-parser-incomplete')
t6 = find_program('test-sgml-parser-incremental')
t7 = find_program('test-sgml-parser-lines')
t8 = find_program('test-sgml-parser-random')
test('dom-configuration-basic', t1, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)
test('sgml-dump-basic', t2, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)
test('sgml-parser-basic', t3, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)
test('sgml-parser-error', t4, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)
test('sgml-parser-incomplete', t5, env: test_lib, workdir: meson.current_build_dir())
test('sgml-parser-incremental', t6, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)
test('sgml-parser-lines', t7, env: test_lib, workdir: meson.current_build_dir())
test('sgml-parser-random', t8, env: test_lib, workdir: meson.current_build_dir(), should_fail: true)

View File

@ -21,6 +21,13 @@
unsigned int number_of_lines = 0; unsigned int number_of_lines = 0;
/* fake tty get function, needed for charsets.c */
int
get_ctl_handle()
{
return -1;
}
static int static int
update_number_of_lines(struct dom_stack *stack) update_number_of_lines(struct dom_stack *stack)
{ {

0
src/protocol/ftp/test-ftp-parser Normal file → Executable file
View File