Skip to content

Commit e61e919

Browse files
committed
[tests] Check cpp.Pointer.ofArray with empty array
1 parent 208010a commit e61e919

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/native/tests/TestPtr.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ class TestPtr extends Test
213213

214214
static function notProcAddress(module:String, func:String) return null;
215215

216+
// See: https://github.com/HaxeFoundation/hxcpp/issues/1028
217+
public function testOfEmptyArray() {
218+
var empty:Array<Dynamic> = [];
219+
cpp.Pointer.ofArray( empty );
220+
Assert.equals( 0, empty.length );
221+
222+
var emptyInt:Array<Int> = [];
223+
cpp.Pointer.ofArray( emptyInt );
224+
Assert.equals( 0, emptyInt.length );
225+
}
226+
216227
public function testArrayAccess() {
217228
var array = [ 0.0, 1.1, 2.2, 3.3 ];
218229
var ptr = cpp.Pointer.arrayElem(array, 0);

0 commit comments

Comments
 (0)