/// COMMENT This testsuite tests the following ....
/// PASS
int a = 1;
/// PASS
/// TOPLEVEL
/* A simple global var. */
var int x = 0;
/// FAIL
/// COMMENT this should fail
int a = "";
/// PASS
/// package a
/// TOPLEVEL
class A
{
int x = f();
}
int f() = 0;
/// package b import a
;
TestCase? keywords are all prefixed with ///. On root level (without any whitespace indentation) currently following keywords are allowed
bug at the end of the line.
I such a testcase is indeed found to include an error, well we knew it and print nothing. But if it works, then print a victorious message! :-). In the summary:
known bugs: 2 fixed: 1Testcases may contain the TOPLEVEL keyword that has the following meaning: everything in front of the TOPLEVEL keyword will be collected in the main() method. Statements behind the TOPLEVEL keyword are global to the package, like global variables, functions, methods and class definitions. PACKAGE The PACKAGE keyword indicates which package the sources should belong to. More than one PACKAGE keyword can be declared to build a testcase with a certain package structure. Packages can be imported by the PACKAGE some IMPORT other keywords.
/// GLOBAL int g1 = 1 /// PASS /* access to g1 only */ int a = 1; /// GLOBAL int g2 = 2 /// PASS /* access to g1 and g2 */ /// TOPLEVEL /* A simple global var. */ var int x = 0;Because globals are accessible only in the same file, placing global sources at the end of the file makes no sense.
/// COMMENT This testsuite describes ....
/// GLOBAL
...
/// PASS
/// COMMENT This testcase demonstartes ...
/// COMMENT ... line two of testcase comment ...
...
/// COMMENT here we could comment the end of the testsuite :)
Activating comments in the output can be done by specifying the -comment flag in the command line
java -classpath /usr/share/java/nice.jar nice.tools.testsuite.TestNice ~/testsuite/ -comment
or
java -classpath /usr/share/java/nice.jar nice.tools.testsuite.TestNice -comment ~/testsuite/
While running the testcases temporary files and folders are created in "testsuite-temp-folder". Testcases that fail, in the sense of that they don't behave like expected (pass or fail) are collected in the folder "testsuite-fail-folder" for later investigation purposes. In this folder, each testcase is grouped in its own folder that is numbered from "1" on in ascending order. At the next testsuite run both folders are initially cleared. -- AlexGreif? - 27 Jun 2002
/// FAIL test, it is often desirable to specify where (which line, which column) the error should be reported. This allows for checking that the compiler gives the good location to the user, and also that the test does not fail "by accident", for an other unrelated reason (for instance a syntax error when writing the test).
This can be done, by embedding a comment of the form
/* /// FAIL HERE */ just before the location of the desired error in the test source.
Warnings that result from wrong FAIL HERE positions are treated sort of failures. Thus the source code is shown and the compiler results.
make check in the main directory of Nice.
To run a specific subset, you can use:
java -Dassertions=true -classpath classes nice.tools.testsuite.TestNice testsuite/<directory>If you use Java 1.4 or later, use
java -ea instead of java -Dassertions=true (this should also be done in the Makefile, but how do we make it work for both 1.3 and 1.4?).
/// TYPE Type1 SUBTYPE OF Type2In the engine, this would be expanded to some Nice source that will compile if and only if Type1 is a subtype of Type2. This is not urgent. If we really need something like this, perhaps it would be wiser (and more fun!) to transition the testsuite to a set of Nice functions, so that test cases could be written in Nice itself.
| Topic TestSuite . { Edit | Attach | Ref-By | Printable | Diffs | r1.5 | > | r1.4 | > | r1.3 | More } |
|
Revision r1.5 - 02 Aug 2003 - 15:40 GMT - DanielBonniot Parents: WebHome > ToolsAndLibraries |
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding TWiki? Send feedback. |