Improve testing support

This commit is contained in:
Joshua Granick
2015-01-29 12:00:58 -08:00
parent 9777ef4001
commit 41fcc1f4df
5 changed files with 36 additions and 77 deletions

View File

@@ -58,11 +58,7 @@ class ApplicationMain {
}
#if js
#if munit
embed (null, ::WIN_WIDTH::, ::WIN_HEIGHT::, "::WIN_FLASHBACKGROUND::");
#end
#else
#if (!html5 || munit)
create ();
#end
@@ -71,6 +67,8 @@ class ApplicationMain {
public static function start ():Void {
#if !munit
app = new ::APP_MAIN:: ();
app.create (config);
@@ -80,6 +78,12 @@ class ApplicationMain {
Sys.exit (result);
#end
#else
new ::APP_MAIN:: ();
#end
}

View File

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

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="Validation" package="org.openfl.validation" version="1.0.0" company="OpenFL" />
<meta title="Validation" package="org.openfl.lime.validation" version="1.0.0" company="OpenFL" />
<app file="TestMain" main="TestMain" path="build" />
<source path="test" />
<haxelib name="openfl" />
<haxelib name="lime" />
<haxelib name="munit" />
<haxelib name="mlib" />
<haxelib name="hamcrest" />

View File

@@ -1,70 +0,0 @@
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);
}
}

View File

@@ -0,0 +1,24 @@
package lime;
import massive.munit.Assert;
class WindowTest {
public function new () {
}
@Test public function todo ():Void {
Assert.isTrue(true);
}
}