O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Testing the writer

A good way to test our newly created function is to continue after our first test and just save the result of parseConfigurationFile.

So, here is the new test class:

class ComponentImpl
{
public static function main(): Void
{
var comp = ComponentParser.parseConfigurationFile ("bin/conf.txt");
trace(comp.properties.get("text"));
trace(comp.metadata.get("name"));
//Test writing
ComponentParser.writeConfigurationFile("bin/out.txt", comp);
}
}

After running this test, you should get a file with the following content:

nameMyComponent 1
textHelloWorld 0

As you saw, that was really simple.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required