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.

Get haXe 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.