プログラミング + アカデミック + 何か面白いこと

  1. Programming
  2. 29 view

[haxe]Install and Unite Test

Reference

  • http://openlab.dino.co.jp/2007/09/04/16331033.html
  • http://haxe.org/doc/cross/unit
  • Install

    #Install haxe
    $sudo add-apt-repository ppa:eyecreate/haxe
    $sudo apt-get update
    $sudo apt-get install haxe libneko0
    #Install HTML5
    $sudo mkdir -p /usr/lib/haxe/lib
    $sudo haxelib setup
    $sudo haxelib install html5

    Hello World

    $mkdir src
    $vim src/HelloWorld.hx
    
    class HelloWorld {
        public function new() {
            trace("Hello World!");
        }
     
        public static function main() {
            var app : HelloWorld = new HelloWorld();
        }
    }
    $haxe -cp src -x HelloWorld
    Application.hx:3: Hello World!
    

    Unit Test

    Test Case

    $mkdir test
    $vim test/TestCase.hx
    
    class TestCase extends haxe.unit.TestCase {
        public function testExample(){
            assertEquals( "haxe", "haxe" );
        }   
    }
    

    Test Suite

    $vim test/MyTestSuite.hx
    
    class MyTestSuite {
        static function main(){
            var r = new haxe.unit.TestRunner();
            r.add(new TestCase());
            r.run();
        }
    }
    

    Compile & Execute

    $vim test/compile.hxml
    -neko mytestsuite.n
    -main MyTestSuite
    $haxe test/compile.hxml
    $neko test/mytestsuite.n
    Class: TestCase .
    
    OK 1 tests, 0 failed, 1 success
    

    Programming recent post

    1. Install sbt 1.0.0 and run sample template

    2. [Machine Learning]Created docker image includ…

    3. [Node.js]How to write batch script with Node.…

    4. [Play][Scala]Develop Request Driven Batch Usi…

    5. [OpenCV][Ruby]Auto check web page design corr…

    関連記事

    PAGE TOP