Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 0.33.0 #32

Merged
merged 8 commits into from
Nov 21, 2017
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Francis Bourre

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 53 additions & 0 deletions src/hex/unittest/description/ClassDescriptor.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package hex.unittest.description;

/**
* @author Francis Bourre
*/
typedef ClassDescriptor =
{
/**
* The instance of the test class.
*/
var instance : Dynamic;

/**
* The type of the test class.
*/
var type : Class<Dynamic>;

/**
* The class name of the test class.
*/
var className : String;

/**
* Specifies is the class descripted is a suite.
*/
var isSuiteClass : Bool;

/**
* The life cycle method to be called once, setUp tests in the class are executed.
*/
var beforeClassFieldName : String;

/**
* The life cycle method to be called once, tearDown tests in the class are executed.
*/
var afterClassFieldName : String;

/**
* The life cycle method to be called once, setUp each test in the class is executed.
*/
var setUpFieldName : String;

/**
* The life cycle method to be called once, tearDown each test in the class is executed.
*/
var tearDownFieldName : String;

var classDescriptors : Array<ClassDescriptor>;
var methodDescriptors : Array<MethodDescriptor>;
var classIndex : Int;
var methodIndex : Int;
var name : String;
}
42 changes: 42 additions & 0 deletions src/hex/unittest/description/ClassDescriptorUtil.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package hex.unittest.description;

using Lambda;

/**
* ...
* @author Francis Bourre
*/
class ClassDescriptorUtil
{

function new() throw new hex.error.PrivateConstructorException();

static public function hasNextClass( classDescriptor : ClassDescriptor ) : Bool
return classDescriptor.classIndex < classDescriptor.classDescriptors.length;

static public function nextClass( classDescriptor : ClassDescriptor ) : ClassDescriptor
return classDescriptor.classDescriptors[ classDescriptor.classIndex++ ];

static public function hasNextMethod( classDescriptor : ClassDescriptor ) : Bool
return classDescriptor.methodIndex < classDescriptor.methodDescriptors.length;

static public function nextMethod( classDescriptor : ClassDescriptor ) : MethodDescriptor
return classDescriptor.methodDescriptors[ classDescriptor.methodIndex++ ];

static public function keepOnlyThisMethod( classDescriptor : ClassDescriptor, methodName : String ) : Void
classDescriptor.methodDescriptors = classDescriptor.methodDescriptors.filter( function( descriptor ) return descriptor.methodName == methodName );

static public function currentMethodDescriptor( classDescriptor : ClassDescriptor ) : MethodDescriptor
return classDescriptor.methodDescriptors[ classDescriptor.methodIndex == 0 ? 0 : classDescriptor.methodIndex - 1 ];

static public function length( classDescriptor : ClassDescriptor ) : UInt
{
var l = 0;
for ( descriptor in classDescriptor.classDescriptors ) l += length( descriptor );
l += classDescriptor.methodDescriptors.length;
return l;
}

public static function toString( classDescriptor : ClassDescriptor ) : String
return hex.util.Stringifier.stringify( classDescriptor ) + ':[$classDescriptor.instance, $classDescriptor.type, $classDescriptor.className]';
}
14 changes: 14 additions & 0 deletions src/hex/unittest/description/MethodDescriptor.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package hex.unittest.description;

/**
* ...
* @author Francis Bourre
*/
typedef MethodDescriptor =
{
var methodName : String;
var isAsync : Bool;
var isIgnored : Bool;
var description : String;
var dataProvider : Array<Dynamic>;
}
164 changes: 0 additions & 164 deletions src/hex/unittest/description/TestClassDescriptor.hx

This file was deleted.

34 changes: 0 additions & 34 deletions src/hex/unittest/description/TestMethodDescriptor.hx

This file was deleted.

22 changes: 11 additions & 11 deletions src/hex/unittest/event/ITestClassResultListener.hx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package hex.unittest.event;

import hex.error.Exception;
import hex.unittest.description.TestClassDescriptor;
import hex.unittest.description.ClassDescriptor;

/**
* ...
* @author Francis Bourre
*/
interface ITestClassResultListener
{
function onStartRun( descriptor : TestClassDescriptor ) : Void;
function onEndRun( descriptor : TestClassDescriptor ) : Void;
function onStartRun( descriptor : ClassDescriptor ) : Void;
function onEndRun( descriptor : ClassDescriptor ) : Void;

function onSuiteClassStartRun( descriptor : TestClassDescriptor ) : Void;
function onSuiteClassEndRun( descriptor : TestClassDescriptor ) : Void;
function onTestClassStartRun( descriptor : TestClassDescriptor ) : Void;
function onTestClassEndRun( descriptor : TestClassDescriptor ) : Void;
function onSuiteClassStartRun( descriptor : ClassDescriptor ) : Void;
function onSuiteClassEndRun( descriptor : ClassDescriptor ) : Void;
function onTestClassStartRun( descriptor : ClassDescriptor ) : Void;
function onTestClassEndRun( descriptor : ClassDescriptor ) : Void;

function onSuccess( descriptor : TestClassDescriptor, timeElapsed : Float ) : Void;
function onFail( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void;
function onTimeout( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void;
function onIgnore( descriptor : TestClassDescriptor ) : Void;
function onSuccess( descriptor : ClassDescriptor, timeElapsed : Float ) : Void;
function onFail( descriptor : ClassDescriptor, timeElapsed : Float, error : Exception ) : Void;
function onTimeout( descriptor : ClassDescriptor, timeElapsed : Float, error : Exception ) : Void;
function onIgnore( descriptor : ClassDescriptor ) : Void;
}
Loading