blob: f667066ac2f07c5c401cc9710fe8ad8e01363383 [file] [log] [blame]
========================================================================
The KDE JavaScript Test Suite
========================================================================
This is a collection of JavaScript (aka ECMAScript) code snipplets
used to test the KDE JavaScript library (dubbed kjs). Most of them
once triggered a bug in the implementation of the
interpreter. Allthough these bugs are probably fixed by now theses
tests can still be used for regression testing.
NOTE:
Don't confuse this code with the HTML bindings for the khtml
widget. Those are implemented in a seperate module residing in
kdelibs/khtml/ecma. Test for those can be found elsewhere.
USAGE:
You can evaluate .js files with a binary called 'testkjs' as long as
they contain pure ECMAScript code without any references to browser
specific properties. To build 'testkjs' simply invoke 'make check'
inside of the kdelibs/kjs source directory. Most tests rely on helper
functions like shouldBe(). Those are collected in base.js and have to
be evaluated before the actual test. testkjs accepts multiple input
files in the command line. Therefore a typical test run might look
like this:
testkjs base.js operators.js
For temporary debugging you may use the debug() function which prints
its output to stderr.
NAMING CONVENTION:
*.js regular test
j-*.js JavaScript/JScript extensions not covered by ECMA
*-n.js code that is supposed to trigger a parse/compile error
FUTURE:
All tests could easily be run in a row by a script. If they all stick
to a unified output format (e.g. via shouldBe()) all results can be
parsed and analyzed automatically. Maybe to a summary HTML page. In
case the test suite grows we would need to provide more info about
each test. This could look like:
startTest("ECMA 15.4.2", "Testing the Array Constructor");
// ...
endTest();
PLEA:
In case you find any yet unknown bug please reduce it to a minimal test case
either send it to me or add it to this repository yourself.
Harri Porten <porten@kde.org>