diff --git a/meson.build b/meson.build index 27925c0b4..13f73e126 100644 --- a/meson.build +++ b/meson.build @@ -1169,5 +1169,5 @@ if get_option('doc') endif if get_option('test') - subdir('test') + subdir('test/ecmascript/assert') endif diff --git a/src/ecmascript/spidermonkey/console.cpp b/src/ecmascript/spidermonkey/console.cpp index 1e050fe64..390327887 100644 --- a/src/ecmascript/spidermonkey/console.cpp +++ b/src/ecmascript/spidermonkey/console.cpp @@ -85,9 +85,9 @@ console_assert(JSContext *ctx, unsigned int argc, JS::Value *vp) if (res) { return true; } + failed_assertions++; FILE *log = fopen(console_error_filename, "a"); - failed_assertions++; if (!log) { return true; } diff --git a/src/main/main.c b/src/main/main.c index a0475c356..75ad11187 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -76,6 +76,10 @@ check_stdio(LIST_OF(struct string_list_item) *url_list) { assert(!remote_session_flags); + if (program.testjs) { + return; + } + /* Should the document be read from stdin? */ if (!isatty(STDIN_FILENO)) { /* Only start reading from stdin if no URL was given on the diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c index 5058e8efd..6470f5ea4 100644 --- a/src/osdep/osdep.c +++ b/src/osdep/osdep.c @@ -896,7 +896,9 @@ get_ctl_handle(void) { static int fd = -1; - if (isatty(0)) return 0; + if (isatty(0)) { + return 0; + } if (fd < 0) fd = open("/dev/tty", O_RDONLY); return fd; } diff --git a/test/ecmascript/assert/meson.build b/test/ecmascript/assert/meson.build new file mode 100644 index 000000000..f7b8c1200 --- /dev/null +++ b/test/ecmascript/assert/meson.build @@ -0,0 +1,91 @@ +tofail = [ +'console.assert.html', +'document.getElementsByClassName.html', +'document.getElementsByName.html', +'document.head.html', +'element.namedItem.html' +] +took = [ +'customEvent.html', +'doctype.publicId.html', +'doctype.systemId.html', +'document.anchors.html', +'document.baseURI.html', +'document.body.childNodes.html', +'document.body.children.html', +'document.body.id.html', +'document.characterSet.html', +'document.doctype.html', +'document.documentElement.html', +'document.documentURI.html', +'document.domain.html', +'document.getElementsByTagName.html', +'document.images.html', +'document.links.html', +'document.querySelectorAll.html', +'document.querySelector.html', +'element.appendChild.html', +'element.attributes.html', +'element.checked.html', +'element.childElementCount.html', +'element.className.html', +'element.cloneNode.html', +'element.closest.html', +'element.contains.html', +'element.dir.html', +'element.eventListener.html', +'element.firstChild.html', +'element.firstElementChild.html', +'element.getAttribute.html', +'element.getAttributeNode.html', +'element.getElementsByTagName.html', +'element.hasAttribute.html', +'element.hasAttributes.html', +'element.hasChildNodes.html', +'element.id.html', +'element.innerHTML.html', +'element.insertBefore.html', +'element.isEqualNode.html', +'element.isSameNode.html', +'element.lang.html', +'element.lastChild.html', +'element.lastElementChild.html', +'element.matches.html', +'element.nextElementSibling.html', +'element.nextSibling.html', +'element.nodeName.html', +'element.nodeType.html', +'element.nodeValue.html', +'element.outerHTML.html', +'element.parentElement.html', +'element.parentNode.html', +'element.previousElementSibling.html', +'element.previousSibling.html', +'element.querySelectorAll.html', +'element.querySelector.html', +'element.setAttribute.html', +'event.html', +'eventListener.html', +'keyboardEvent.html', +'navigator.appCodeName.html', +'nodelist.forEach.html', +'URL.html'] + +if conf_data.get('CONFIG_ECMASCRIPT') + foreach t: tofail + test(t, elinks, protocol: 'exitcode', is_parallel: true, timeout: 5, should_fail: true, verbose: false, workdir: '/home/witekfl/GIT/elinks/test/ecmascript/assert/', + args: ['--test', '1', '--eval', 'set ecmascript.enable = 1', + '--eval', 'set ecmascript.enable_console_log = 1', + '--eval', 'set ui.sessions.fork_on_start = 0', + '--no-connect', '1', + t]) + endforeach + foreach t : took + test(t, elinks, protocol: 'exitcode', is_parallel: true, timeout: 5, should_fail: false, verbose: false, workdir: meson.source_root()+'/test/ecmascript/assert', + args: ['--test', '1', '--eval', 'set ecmascript.enable = 1', + '--eval', 'set ecmascript.enable_console_log = 1', + '--eval', 'set ui.sessions.fork_on_start = 0', + '--no-connect', '1', + t]) + endforeach +endif diff --git a/test/meson.build b/test/meson.build deleted file mode 100644 index be13b05c8..000000000 --- a/test/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -if get_option('test') - h = run_command(meson.source_root()+'/test/ecmascript/assert/assert.sh') - tests = h.stdout().strip().split('\n') - foreach t : tests - name = t.split('/')[-1] - test(name, elinks, protocol: 'exitcode', is_parallel: false, workdir: meson.current_build_dir(), - args: ['--test', '1', '--eval', 'set ecmascript.enable = 1', - '--eval', 'set ecmascript.enable_console_log = 1', - '--eval', 'set ui.sessions.fork_on_start = 0', - t]) - endforeach -endif