Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.