Prev | Current Page 336 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The test case class and the first test are ready but it is evident that this code
alone cannot be compiled because the class ERegValidator doesn ??™ t exist yet.
class ERegValidator
{
public function new(value : String, pattern : String, opt : String) {}
public function validate() : Bool
{
return true;
}
}
Now the code is ready to be compiled; but one last thing is missing, an entry class and a main method to
run the tests and see the results.
class Main
{
static function main()
{
var runner = new haxe.unit.TestRunner();
runner.add(new TestERegValidator());
runner.run();
}
}
174
Part I: The Core Language
To make this code work on all of the three platforms, the following .hxml file is used for compilation.
Having the - debug switch activated when compiling unit tests is particularly critical because in case of
failures it is easier to spot and to correct the errors.
# Neko
-neko main.n
-main Main
-debug
--next
# Flash9
-swf main.swf
-swf-version 9
-main Main
-debug
--next
# Javascript
-js main.


Pages:
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348