blob: 2cd374f4cef7df4bb402b3fbc54ed40bdad64c2c [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. Although 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 separate 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>