Skip to content

Commit 59c19e3

Browse files
committed
Cut the Bool member tests down to the storage check
Type.typeof on the member field is the check the fix actually changes, so drop the script helpers and the reads that already passed.
1 parent 6920a42 commit 59c19e3

2 files changed

Lines changed: 2 additions & 56 deletions

File tree

‎test/cppia/Client.hx‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,10 @@ class ClientFoo implements IFoo {
1717
class ClientBoolField {
1818

1919
public var flag:Bool = true;
20-
public var offFlag:Bool = false;
2120

2221
public static var staticFlag:Bool = true;
2322

2423
public function new() {}
25-
26-
public function readFlag():Bool return flag;
27-
28-
public function readOffFlag():Bool return offFlag;
29-
30-
public function flagToString():String return "" + flag;
31-
32-
public function branchOnFlag():Int return flag ? 10 : 20;
33-
34-
public function branchOnOffFlag():Int return offFlag ? 10 : 20;
35-
36-
public function clearFlag():Bool { flag = false; return flag; }
3724
}
3825

3926
class Client

‎test/cppia/cases/TestCommon.hx‎

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -66,49 +66,8 @@ class TestCommon extends Test {
6666
if (Assert.notNull(cls, 'Unable to resolve ClientBoolField')) {
6767
final obj = Type.createInstance(cls, []);
6868

69-
Assert.equals('true', Std.string(Reflect.field(obj, 'flag')), 'Member Bool did not read back as a boolean');
70-
Assert.equals('true', Std.string(Reflect.field(cls, 'staticFlag')), 'Static Bool did not read back as a boolean');
71-
}
72-
}
73-
74-
@:depends(testStatus)
75-
function testBoolMemberFromScript() {
76-
final cls = Type.resolveClass('ClientBoolField');
77-
78-
if (Assert.notNull(cls, 'Unable to resolve ClientBoolField')) {
79-
final obj = Type.createInstance(cls, []);
80-
81-
Assert.equals(true, Reflect.callMethod(obj, Reflect.field(obj, 'readFlag'), []),
82-
'Script read of a true Bool member failed');
83-
Assert.equals(false, Reflect.callMethod(obj, Reflect.field(obj, 'readOffFlag'), []),
84-
'Script read of a false Bool member failed');
85-
Assert.equals('true', Reflect.callMethod(obj, Reflect.field(obj, 'flagToString'), []),
86-
'Bool member did not stringify as a boolean');
87-
Assert.equals(10, Reflect.callMethod(obj, Reflect.field(obj, 'branchOnFlag'), []),
88-
'Branch on a true Bool member took the wrong arm');
89-
Assert.equals(20, Reflect.callMethod(obj, Reflect.field(obj, 'branchOnOffFlag'), []),
90-
'Branch on a false Bool member took the wrong arm');
91-
}
92-
}
93-
94-
@:depends(testStatus)
95-
function testBoolMemberWrite() {
96-
final cls = Type.resolveClass('ClientBoolField');
97-
98-
if (Assert.notNull(cls, 'Unable to resolve ClientBoolField')) {
99-
final obj = Type.createInstance(cls, []);
100-
101-
Assert.equals(false, Reflect.callMethod(obj, Reflect.field(obj, 'clearFlag'), []),
102-
'Script write of a Bool member did not stick');
103-
Assert.equals('false', Std.string(Reflect.field(obj, 'flag')),
104-
'Reflection did not see the script write');
105-
106-
Reflect.setField(obj, 'flag', true);
107-
108-
Assert.equals(true, Reflect.callMethod(obj, Reflect.field(obj, 'readFlag'), []),
109-
'Script did not see the reflection write');
110-
Assert.equals(10, Reflect.callMethod(obj, Reflect.field(obj, 'branchOnFlag'), []),
111-
'Branch did not see the reflection write');
69+
Assert.same(Type.ValueType.TBool, Type.typeof(Reflect.field(obj, 'flag')), 'Member Bool did not read back as a boolean');
70+
Assert.same(Type.ValueType.TBool, Type.typeof(Reflect.field(cls, 'staticFlag')), 'Static Bool did not read back as a boolean');
11271
}
11372
}
11473

0 commit comments

Comments
 (0)