Template out Lime runtime munit test suite

This commit is contained in:
Joshua Granick
2015-01-28 16:14:10 -08:00
parent 774a70aeac
commit 177a4a1b8d
7 changed files with 199 additions and 0 deletions

5
tests/runtime/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
build
report
src
test/TestMain.hx
test/TestSuite.hx

6
tests/runtime/.munit Normal file
View File

@@ -0,0 +1,6 @@
version=src
src=test
bin=build
report=report
hxml=test.hxml
classPaths=src

38
tests/runtime/README.md Normal file
View File

@@ -0,0 +1,38 @@
Install
-------
git clone https://github.com/openfl/openfl-validation
haxelib dev openfl-validation openfl-validation
haxelib install munit
Testing
-------------
First, change to the openfl-validation directory:
cd openfl-validation
Next, you can test HTML5 and Flash using munit:
haxelib run munit test
Other targets can be tested using the normal OpenFL test commands:
lime test windows
lime test windows -neko
lime test mac
lime test mac -neko
lime test linux
lime test linux -neko
lime test ios
lime test ios -simulator
lime test android
lime test blackberry
lime test blackberry -simulator
Contributing
-------------
If you would like to contribute a test, create a fork of the repository, then make a pull request with your addition.
Tests are organized based upon the class, then the method or property which has been tested. This will help us validate across the full API, and when there are problems, will help identify exactly which property or method needs to be improved for the specific target. Remember to remove @Ignore when you finish a test.

17
tests/runtime/project.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="Validation" package="org.openfl.validation" version="1.0.0" company="OpenFL" />
<app file="TestMain" main="TestMain" path="build" />
<source path="test" />
<haxelib name="openfl" />
<haxelib name="munit" />
<haxelib name="mlib" />
<haxelib name="hamcrest" />
<haxelib name="format" />
<!-- <template path="src/index.html" rename="index.html" if="html5" />
-->
</project>

5
tests/runtime/run.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
lime test neko
lime test cpp
haxelib run munit gen
haxelib run munit test

58
tests/runtime/test.hxml Normal file
View File

@@ -0,0 +1,58 @@
## Flash 9+
-main TestMain
-lib munit
-lib hamcrest
-lib mlib
-lib lime
-D web
-cp test
-swf-version 11.3
-swf build/as3_test.swf
# Trick munit into building our app
-cmd haxelib run lime build html5
#-cmd openfl build neko
#-cmd mv build/linux64/neko/obj/ApplicationMain.n build/linux64/neko/bin/Validation.n
#-cmd lime update linux
--next
## JavaScript
-js build/html5/bin/TestMain.js
--no-output
--next
## Neko
#-neko build/linux64/neko/bin/Validation.n
#--no-output
#--next
## C++
#-main ApplicationMain
#-cp build/linux64/cpp/haxe
#-cp test
#-lib openfl
#-lib munit
#-lib hamcrest
#-lib mlib
#-lib openfl-native
#-D linux
#-D desktop
#-D HXCPP_M64
#-D display
#-cpp build/linux64/cpp/bin
#--remap flash:flash
#--no-output

View File

@@ -0,0 +1,70 @@
package;
import massive.munit.util.Timer;
import massive.munit.Assert;
import massive.munit.async.AsyncFactory;
/**
* Auto generated ExampleTest for MassiveUnit.
* This is an example test class can be used as a template for writing normal and async tests
* Refer to munit command line tool for more information (haxelib run munit)
*/
class ExampleTest
{
private var timer:Timer;
public function new()
{
}
@BeforeClass
public function beforeClass():Void
{
}
@AfterClass
public function afterClass():Void
{
}
@Before
public function setup():Void
{
}
@After
public function tearDown():Void
{
}
@Test
public function testExample():Void
{
Assert.isTrue(true);
}
@AsyncTest
public function testAsyncExample(factory:AsyncFactory):Void
{
var handler:Dynamic = factory.createHandler(this, onTestAsyncExampleComplete, 300);
timer = Timer.delay(handler, 200);
}
private function onTestAsyncExampleComplete():Void
{
Assert.isFalse(false);
}
/**
* test that only runs when compiled with the -D testDebug flag
*/
@TestDebug
public function testExampleThatOnlyRunsWithDebugFlag():Void
{
Assert.isTrue(true);
}
}