Tech Tips

  1. プログラミング
  2. 251 view

[haxe]環境構築

Contents

参考にした記事。というか以下をまとめただけ

インストール

#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!

ユニットテスト

テストケース

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

テストスイート

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

コンパイルと実行

$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

プログラミングの最近記事

  1. PlatformIO IDE for VSCode を使用して VSCode で Ardu…

  2. ROS Docker イメージで発生した GPG error の解消方法

  3. Streamlit で訪れた国を色づけした世界地図を作成できるアプリケーションを作成してみ…

  4. M5Stack Core2 for AWS – ESP32 IoT開発キットで…

  5. D3.js v7 で点・線・テキスト・ツールチップ・ズームを設定する方法

関連記事

PAGE TOP