expr bind old value test

This commit is contained in:
Dima Granetchi
2014-11-26 14:24:29 +02:00
parent cffbc15150
commit 316565a168
2 changed files with 9 additions and 4 deletions
-1
View File
@@ -7,7 +7,6 @@ import buddy.BuddySuite;
using buddy.Should;
//@exclude
class ChainBindTest extends BuddySuite {
public function new() {
+9 -3
View File
@@ -7,7 +7,6 @@ import buddy.BuddySuite;
using buddy.Should;
//@exclude
class ExprBindTest extends BuddySuite {
public function new() {
@@ -15,7 +14,9 @@ class ExprBindTest extends BuddySuite {
describe("Using BindExt.expr", {
var callNum:Int;
var from:String;
before({
from = null;
callNum = 0;
});
@@ -26,7 +27,9 @@ class ExprBindTest extends BuddySuite {
b.str = "b1";
inline function val() return b.str + "ab".charAt(a.str.length - 2) + Std.string(1);
BindExt.expr(b.str + "ab".charAt(a.str.length - 2) + Std.string(1), function (from, to:String) {
BindExt.expr(b.str + "ab".charAt(a.str.length - 2) + Std.string(1), function (f, to:String) {
f.should.be(from);
from = to;
to.should.be(val());
callNum ++;
});
@@ -50,8 +53,11 @@ class ExprBindTest extends BuddySuite {
b.str = "";
c.str = "1";
inline function val() return if (a.str.charAt(b.str.length) == Std.string(c.str)) 1 else 0;
var from:Null<Int> = null;
BindExt.expr(if (a.str.charAt(b.str.length) == Std.string(c.str)) 1 else 0, function (from, to:Null<Int>) {
BindExt.expr(if (a.str.charAt(b.str.length) == Std.string(c.str)) 1 else 0, function (f, to:Null<Int>) {
f.should.be(from);
from = to;
to.should.be(val());
callNum ++;
});