idea strict parser support

This commit is contained in:
Dima Granetchi
2015-01-21 02:46:15 +02:00
parent 95aa6865f2
commit 181191797b
9 changed files with 68 additions and 68 deletions
+18 -18
View File
@@ -11,17 +11,17 @@ class BaseTest extends BuddySuite {
public function new() { public function new() {
super(); super();
describe("Using base functionality", { describe("Using base functionality", function () {
var b:Bindable1; var b:Bindable1;
var callNum:Int; var callNum:Int;
before({ before(function () {
b = new Bindable1(); b = new Bindable1();
callNum = 0; callNum = 0;
}); });
it("bindx should bind/unbind fields (lazySignal=true)", { it("bindx should bind/unbind fields (lazySignal=true)", function () {
var strFrom = b.str = "a"; var strFrom = b.str = "a";
var callNum2 = 0; var callNum2 = 0;
@@ -51,7 +51,7 @@ class BaseTest extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind fields (lazySignal=false)", { it("bindx should bind/unbind fields (lazySignal=false)", function () {
var strFrom = b.str2 = "a"; var strFrom = b.str2 = "a";
var callNum2 = 0; var callNum2 = 0;
@@ -81,7 +81,7 @@ class BaseTest extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind 'null' values (lazySignal=true)", { it("bindx should bind/unbind 'null' values (lazySignal=true)", function () {
var strFrom = b.str = null; var strFrom = b.str = null;
var callNum2 = 0; var callNum2 = 0;
var listener = function (from:String, to:String) { var listener = function (from:String, to:String) {
@@ -109,7 +109,7 @@ class BaseTest extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind 'null' values (lazySignal=false)", { it("bindx should bind/unbind 'null' values (lazySignal=false)", function () {
var strFrom = b.str2 = null; var strFrom = b.str2 = null;
var callNum2 = 0; var callNum2 = 0;
var listener = function (from:String, to:String) { var listener = function (from:String, to:String) {
@@ -137,7 +137,7 @@ class BaseTest extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind 2 objects (lazySignal=true)", { it("bindx should bind 2 objects (lazySignal=true)", function() {
var callNum2 = 0; var callNum2 = 0;
var target = {a:""}; var target = {a:""};
var s = ""; var s = "";
@@ -157,7 +157,7 @@ class BaseTest extends BuddySuite {
s.should.be(prev); s.should.be(prev);
}); });
it("bindx should bind 2 objects (lazySignal=false)", { it("bindx should bind 2 objects (lazySignal=false)", function () {
var callNum2 = 0; var callNum2 = 0;
var target = {a:""}; var target = {a:""};
var s = ""; var s = "";
@@ -176,7 +176,7 @@ class BaseTest extends BuddySuite {
s.should.be(prev); s.should.be(prev);
}); });
it("bindx should bind and notify methods (lazySignal=true)", { it("bindx should bind and notify methods (lazySignal=true)", function () {
var listener = function () callNum++; var listener = function () callNum++;
bind(b.bind, listener); bind(b.bind, listener);
Bind.notify(b.bind); Bind.notify(b.bind);
@@ -189,7 +189,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should bind and notify methods (lazySignal=false)", { it("bindx should bind and notify methods (lazySignal=false)", function () {
var listener = function () callNum++; var listener = function () callNum++;
bind(b.bind2, listener); bind(b.bind2, listener);
Bind.notify(b.bind2); Bind.notify(b.bind2);
@@ -202,7 +202,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should notify properties manual (lazySignal=true)", { it("bindx should notify properties manual (lazySignal=true)", function () {
b.str = "3"; b.str = "3";
var f = "1"; var f = "1";
var t = "2"; var t = "2";
@@ -217,7 +217,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should notify properties manual (lazySignal=false)", { it("bindx should notify properties manual (lazySignal=false)", function () {
b.str2 = "3"; b.str2 = "3";
var f = "1"; var f = "1";
var t = "2"; var t = "2";
@@ -232,7 +232,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should unbind all properties listeners (lazySignal=true)", { it("bindx should unbind all properties listeners (lazySignal=true)", function () {
bind(b.str, function (from, to) callNum++); bind(b.str, function (from, to) callNum++);
bind(b.str, function (from, to) callNum++); bind(b.str, function (from, to) callNum++);
@@ -242,7 +242,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all properties listeners (lazySignal=false)", { it("bindx should unbind all properties listeners (lazySignal=false)", function () {
bind(b.str2, function (from, to) callNum++); bind(b.str2, function (from, to) callNum++);
bind(b.str2, function (from, to) callNum++); bind(b.str2, function (from, to) callNum++);
@@ -252,7 +252,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all bindings (signal exists) (lazySignal=true/false)", { it("bindx should unbind all bindings (signal exists) (lazySignal=true/false)", function () {
bind(b.str, function (_, _) callNum++); // create binding signal bind(b.str, function (_, _) callNum++); // create binding signal
bind(b.str2, function (_, _) callNum++); bind(b.str2, function (_, _) callNum++);
bind(b.bind, function () callNum++); bind(b.bind, function () callNum++);
@@ -273,7 +273,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all bindings (signal expected) (lazySignal=true/false)", { it("bindx should unbind all bindings (signal expected) (lazySignal=true/false)", function () {
Bind.unbindAll(b); Bind.unbindAll(b);
try { try {
@@ -289,7 +289,7 @@ class BaseTest extends BuddySuite {
true.should.be(true); true.should.be(true);
}); });
it("bindx should resolve typedefs", { it("bindx should resolve typedefs", function () {
var a:TypeBindable1 = new TypeBindable1(); var a:TypeBindable1 = new TypeBindable1();
Bind.bind(a.str, function (_, _) { Bind.bind(a.str, function (_, _) {
callNum ++; callNum ++;
@@ -299,7 +299,7 @@ class BaseTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should resolve parametric types", { it("bindx should resolve parametric types", function () {
var b = new GenericBindable<TypeBindable1>(); var b = new GenericBindable<TypeBindable1>();
b.a = new TypeBindable1(); b.a = new TypeBindable1();
Bind.bind(b.a.str, function (_, _) { Bind.bind(b.a.str, function (_, _) {
+8 -8
View File
@@ -11,7 +11,7 @@ class ChainBindTest extends BuddySuite {
public function new() { public function new() {
describe("Using BindExt.chain", { describe("Using BindExt.chain", function () {
var from:String; var from:String;
var val:String; var val:String;
@@ -19,7 +19,7 @@ class ChainBindTest extends BuddySuite {
var callNum:Int; var callNum:Int;
var target:{a:String}; var target:{a:String};
before({ before(function () {
from = null; from = null;
val = "a"; val = "a";
b = new BindableChain(4); b = new BindableChain(4);
@@ -27,7 +27,7 @@ class ChainBindTest extends BuddySuite {
callNum = 0; callNum = 0;
}); });
it("BindExt.chain should bind chain changes (unset links)", { it("BindExt.chain should bind chain changes (unset links)", function () {
b.c.c.d = val; b.c.c.d = val;
var listener = function (f:String, t:String) { var listener = function (f:String, t:String) {
@@ -61,7 +61,7 @@ class ChainBindTest extends BuddySuite {
callNum.should.be(5); callNum.should.be(5);
}); });
it("BindExt.chain should bind chain changes (null links)", { it("BindExt.chain should bind chain changes (null links)", function () {
b.c = null; b.c = null;
val = null; val = null;
@@ -84,7 +84,7 @@ class ChainBindTest extends BuddySuite {
callNum.should.be(3); callNum.should.be(3);
}); });
it("BindExt.chain should bind chain changes (0 gap)", { it("BindExt.chain should bind chain changes (0 gap)", function () {
var b2 = new BindableChain(4); var b2 = new BindableChain(4);
b.c.c.f("tada").d = val; b.c.c.f("tada").d = val;
b2.c.c.f("tada").d = val; b2.c.c.f("tada").d = val;
@@ -121,7 +121,7 @@ class ChainBindTest extends BuddySuite {
callNum.should.be(4); callNum.should.be(4);
}); });
it("BindExt.chain should bind chain changes (1 gap)", { it("BindExt.chain should bind chain changes (1 gap)", function () {
b.c.nc.c.f("tada").d = "a"; b.c.nc.c.f("tada").d = "a";
var unbind = BindExt.chain(b.c.nc.c.f("tada").d, function (f:String, t:String) { var unbind = BindExt.chain(b.c.nc.c.f("tada").d, function (f:String, t:String) {
f.should.be(from); f.should.be(from);
@@ -166,7 +166,7 @@ class ChainBindTest extends BuddySuite {
callNum.should.be(3); callNum.should.be(3);
}); });
it("BindExt.chain should bind chain changes (double gap)", { it("BindExt.chain should bind chain changes (double gap)", function () {
b.c.nc.nc.d = "a"; b.c.nc.nc.d = "a";
BindExt.chain(b.c.nc.nc.d, function (f, t:String) { BindExt.chain(b.c.nc.nc.d, function (f, t:String) {
@@ -205,7 +205,7 @@ class ChainBindTest extends BuddySuite {
callNum.should.be(2); callNum.should.be(2);
}); });
it("BindExt.chain should bind default fields", { it("BindExt.chain should bind default fields", function () {
b.d = val = "a"; b.d = val = "a";
var unbind = BindExt.chain(b.d, function (f:String, t:String) { var unbind = BindExt.chain(b.d, function (f:String, t:String) {
+4 -4
View File
@@ -11,18 +11,18 @@ class ExprBindTest extends BuddySuite {
public function new() { public function new() {
describe("Using BindExt.expr", { describe("Using BindExt.expr", function () {
var callNum:Int; var callNum:Int;
var from:String; var from:String;
var target:{a:String}; var target:{a:String};
before({ before(function () {
target = {a:null}; target = {a:null};
from = null; from = null;
callNum = 0; callNum = 0;
}); });
it("BindExt.chain should bind simple expr", { it("BindExt.chain should bind simple expr", function () {
var a = new BaseTest.Bindable1(); var a = new BaseTest.Bindable1();
var b = new BaseTest.Bindable1(); var b = new BaseTest.Bindable1();
a.str = "a1"; a.str = "a1";
@@ -51,7 +51,7 @@ class ExprBindTest extends BuddySuite {
callNum.should.be(3); callNum.should.be(3);
}); });
it("BindExt.chain should bind complex expresions", { it("BindExt.chain should bind complex expresions", function () {
var a = new BaseTest.Bindable1(); var a = new BaseTest.Bindable1();
var b = new BaseTest.Bindable1(); var b = new BaseTest.Bindable1();
var c = new BaseTest.Bindable1(); var c = new BaseTest.Bindable1();
+3 -3
View File
@@ -10,17 +10,17 @@ class ForceTest extends BuddySuite {
public function new() { public function new() {
describe("Using @:bindable(force=true)", { describe("Using @:bindable(force=true)", function () {
var b:BindableForce; var b:BindableForce;
var callNum:Int; var callNum:Int;
before({ before(function () {
b = new BindableForce(); b = new BindableForce();
callNum = 0; callNum = 0;
}); });
it("bindx should correct work with 'force' fields", { it("bindx should correct work with 'force' fields", function () {
Bind.bind(b.str, function (_, _) callNum++); Bind.bind(b.str, function (_, _) callNum++);
Bind.bind(b.str2, function (_, _) callNum++); Bind.bind(b.str2, function (_, _) callNum++);
Bind.bind(b.str3, function (_, _) callNum++); Bind.bind(b.str3, function (_, _) callNum++);
+3 -3
View File
@@ -10,18 +10,18 @@ class InheritanceTest extends BuddySuite {
public function new() { public function new() {
super(); super();
describe("Using classes inheritance", { describe("Using classes inheritance", function () {
var b:BindableChild; var b:BindableChild;
var bp:BindableParent; var bp:BindableParent;
var callNum:Int; var callNum:Int;
before({ before(function () {
b = new BindableChild(); b = new BindableChild();
bp = new BindableParent(); bp = new BindableParent();
callNum = 0; callNum = 0;
}); });
it("bindx should support class/interface inheritance", { it("bindx should support class/interface inheritance", function () {
b.i = 1; b.i = 1;
b.s = "a"; b.s = "a";
Bind.bind(b.i, function (_, _) callNum++); Bind.bind(b.i, function (_, _) callNum++);
+4 -4
View File
@@ -12,13 +12,13 @@ class InlineTest extends BuddySuite {
public function new() { public function new() {
describe("Using @:bindable(inlineSetter=true/false, inlineSignalGetter=true/false)", { describe("Using @:bindable(inlineSetter=true/false, inlineSignalGetter=true/false)", function () {
var b:BindableInline; var b:BindableInline;
var cd:Classdef; var cd:Classdef;
var foundFields:Int; var foundFields:Int;
before({ before(function () {
foundFields = 0; foundFields = 0;
b = new BindableInline(); b = new BindableInline();
var rttiData:String = untyped BindableInline.__rtti; var rttiData:String = untyped BindableInline.__rtti;
@@ -26,7 +26,7 @@ class InlineTest extends BuddySuite {
cd = switch (rtti) { case TClassdecl(c): c; case _: null; }; cd = switch (rtti) { case TClassdecl(c): c; case _: null; };
}); });
it("bindx should generate inline setter", { it("bindx should generate inline setter", function () {
for (c in cd.fields) { for (c in cd.fields) {
switch (c.name) { switch (c.name) {
case "set_str": case "set_str":
@@ -41,7 +41,7 @@ class InlineTest extends BuddySuite {
foundFields.should.be(2); foundFields.should.be(2);
}); });
it("bindx should generate inline signal getter", { it("bindx should generate inline signal getter", function () {
for (c in cd.fields) { for (c in cd.fields) {
switch (c.name) { switch (c.name) {
case "get_str3Changed": case "get_str3Changed":
+5 -5
View File
@@ -10,17 +10,17 @@ class MetaTest extends BuddySuite {
public function new() { public function new() {
describe("Using @bindable meta inheritance", { describe("Using @bindable meta inheritance", function () {
var b:BindableMeta; var b:BindableMeta;
var callNum:Int; var callNum:Int;
before({ before(function () {
b = new BindableMeta(); b = new BindableMeta();
callNum = 0; callNum = 0;
}); });
it("bindx inherit metadata bindable for public fields", { it("bindx inherit metadata bindable for public fields", function () {
b.str = "a"; b.str = "a";
Bind.bind(b.str, function(_, _) callNum++); Bind.bind(b.str, function(_, _) callNum++);
@@ -28,7 +28,7 @@ class MetaTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx inherit metadata bindable for public fields", { it("bindx inherit metadata bindable for public fields", function () {
b.str2 = "a"; b.str2 = "a";
Bind.bind(b.str2, function(_, _) callNum++); Bind.bind(b.str2, function(_, _) callNum++);
@@ -36,7 +36,7 @@ class MetaTest extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx inherit metadata params", { it("bindx inherit metadata params", function () {
@:privateAccess b.strChanged.should.not.be(null); @:privateAccess b.strChanged.should.not.be(null);
@:privateAccess b.str2Changed.should.not.be(null); @:privateAccess b.str2Changed.should.not.be(null);
}); });
+8 -8
View File
@@ -10,17 +10,17 @@ class SignalTest extends BuddySuite {
public function new() { public function new() {
super(); super();
describe("Using BindSignal", { describe("Using BindSignal", function () {
var fs:FieldSignal<String>; var fs:FieldSignal<String>;
var callNum:Int; var callNum:Int;
before({ before(function () {
fs = new FieldSignal<String>(); fs = new FieldSignal<String>();
callNum = 0; callNum = 0;
}); });
it("signal listeners should listen signal", { it("signal listeners should listen signal", function () {
var f = "1"; var f = "1";
var t = "2"; var t = "2";
function listener(from:String, to:String) { function listener(from:String, to:String) {
@@ -49,7 +49,7 @@ class SignalTest extends BuddySuite {
callNum.should.be(3); callNum.should.be(3);
}); });
it("signal should correct add/remove listeners", { it("signal should correct add/remove listeners", function () {
function listener2(_, _) { function listener2(_, _) {
callNum ++; callNum ++;
} }
@@ -79,7 +79,7 @@ class SignalTest extends BuddySuite {
callNum.should.be(4); // all listeners removed callNum.should.be(4); // all listeners removed
}); });
it("signal should correct dispatch in listener", { it("signal should correct dispatch in listener", function () {
function listener(_, _) { function listener(_, _) {
fs.remove(listener); fs.remove(listener);
fs.dispatch(null, null); fs.dispatch(null, null);
@@ -97,17 +97,17 @@ class SignalTest extends BuddySuite {
}); });
}); });
describe("Using MethodSignal", { describe("Using MethodSignal", function () {
var ms:MethodSignal; var ms:MethodSignal;
var callNum:Int; var callNum:Int;
before({ before(function () {
ms = new MethodSignal(); ms = new MethodSignal();
callNum = 0; callNum = 0;
}); });
it("signal listeners should listen signal", { it("signal listeners should listen signal", function () {
function listener() { function listener() {
callNum ++; callNum ++;
ms.remove(listener); ms.remove(listener);
+14 -14
View File
@@ -10,17 +10,17 @@ class TestProperty extends BuddySuite {
public function new() { public function new() {
super(); super();
describe("Using bind properties", { describe("Using bind properties", function () {
var b:BindableProperty; var b:BindableProperty;
var callNum:Int; var callNum:Int;
before({ before(function () {
b = new BindableProperty(); b = new BindableProperty();
callNum = 0; callNum = 0;
}); });
it("bindx should bind/unbind fields (lazySignal=true)", { it("bindx should bind/unbind fields (lazySignal=true)", function () {
var strFrom = b.str = "a"; var strFrom = b.str = "a";
var callNum2 = 0; var callNum2 = 0;
@@ -50,7 +50,7 @@ class TestProperty extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind fields (lazySignal=false)", { it("bindx should bind/unbind fields (lazySignal=false)", function () {
var strFrom = b.str2 = "a"; var strFrom = b.str2 = "a";
var callNum2 = 0; var callNum2 = 0;
@@ -80,7 +80,7 @@ class TestProperty extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind 'null' values (lazySignal=true)", { it("bindx should bind/unbind 'null' values (lazySignal=true)", function () {
var strFrom = b.str = null; var strFrom = b.str = null;
var callNum2 = 0; var callNum2 = 0;
var listener = function (from:String, to:String) { var listener = function (from:String, to:String) {
@@ -108,7 +108,7 @@ class TestProperty extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind/unbind 'null' values (lazySignal=false)", { it("bindx should bind/unbind 'null' values (lazySignal=false)", function () {
var strFrom = b.str2 = null; var strFrom = b.str2 = null;
var callNum2 = 0; var callNum2 = 0;
var listener = function (from:String, to:String) { var listener = function (from:String, to:String) {
@@ -136,7 +136,7 @@ class TestProperty extends BuddySuite {
callNum2.should.be(1); callNum2.should.be(1);
}); });
it("bindx should bind 2 objects (lazySignal=true)", { it("bindx should bind 2 objects (lazySignal=true)", function () {
var callNum2 = 0; var callNum2 = 0;
var target = {a:""}; var target = {a:""};
var s = ""; var s = "";
@@ -156,7 +156,7 @@ class TestProperty extends BuddySuite {
s.should.be(prev); s.should.be(prev);
}); });
it("bindx should bind 2 objects (lazySignal=false)", { it("bindx should bind 2 objects (lazySignal=false)", function () {
var callNum2 = 0; var callNum2 = 0;
var target = {a:""}; var target = {a:""};
var s = ""; var s = "";
@@ -175,7 +175,7 @@ class TestProperty extends BuddySuite {
s.should.be(prev); s.should.be(prev);
}); });
it("bindx should notify properties manual (lazySignal=true)", { it("bindx should notify properties manual (lazySignal=true)", function () {
b.str = "3"; b.str = "3";
var f = "1"; var f = "1";
var t = "2"; var t = "2";
@@ -190,7 +190,7 @@ class TestProperty extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should notify properties manual (lazySignal=false)", { it("bindx should notify properties manual (lazySignal=false)", function () {
b.str2 = "3"; b.str2 = "3";
var f = "1"; var f = "1";
var t = "2"; var t = "2";
@@ -205,7 +205,7 @@ class TestProperty extends BuddySuite {
callNum.should.be(1); callNum.should.be(1);
}); });
it("bindx should unbind all properties listeners (lazySignal=true)", { it("bindx should unbind all properties listeners (lazySignal=true)", function () {
bind(b.str, function (from, to) callNum++); bind(b.str, function (from, to) callNum++);
bind(b.str, function (from, to) callNum++); bind(b.str, function (from, to) callNum++);
@@ -215,7 +215,7 @@ class TestProperty extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all properties listeners (lazySignal=false)", { it("bindx should unbind all properties listeners (lazySignal=false)", function () {
bind(b.str2, function (from, to) callNum++); bind(b.str2, function (from, to) callNum++);
bind(b.str2, function (from, to) callNum++); bind(b.str2, function (from, to) callNum++);
@@ -225,7 +225,7 @@ class TestProperty extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all bindings (signal exists) (lazySignal=true/false)", { it("bindx should unbind all bindings (signal exists) (lazySignal=true/false)", function () {
bind(b.str, function (_, _) callNum++); // create binding signal bind(b.str, function (_, _) callNum++); // create binding signal
bind(b.str2, function (_, _) callNum++); bind(b.str2, function (_, _) callNum++);
@@ -242,7 +242,7 @@ class TestProperty extends BuddySuite {
callNum.should.be(0); callNum.should.be(0);
}); });
it("bindx should unbind all bindings (signal expected) (lazySignal=true/false)", { it("bindx should unbind all bindings (signal expected) (lazySignal=true/false)", function () {
Bind.unbindAll(b); Bind.unbindAll(b);
try { try {