[gjs] tests: Adapt testByteArray() to new gimarshallingtests
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] tests: Adapt testByteArray() to new gimarshallingtests
- Date: Fri, 17 Jun 2011 16:20:42 +0000 (UTC)
commit 6299dddfa8153df75f8e13cb89444e9c674aaa53
Author: Colin Walters <walters verbum org>
Date: Fri Jun 17 12:17:31 2011 -0400
tests: Adapt testByteArray() to new gimarshallingtests
This squashes a memory leak, and is a more interesting test too.
test/js/testGIMarshalling.js | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/test/js/testGIMarshalling.js b/test/js/testGIMarshalling.js
index 12d9623..29975e2 100644
--- a/test/js/testGIMarshalling.js
+++ b/test/js/testGIMarshalling.js
@@ -148,14 +148,17 @@ function testGArray() {
}
function testByteArray() {
+ var i = 0;
+ var refByteArray = new imports.byteArray.ByteArray();
+ refByteArray[i++] = 0;
+ refByteArray[i++] = 49;
+ refByteArray[i++] = 0xFF;
+ refByteArray[i++] = 51;
var byteArray = GIMarshallingTests.bytearray_full_return();
- assertEquals("arrayLength", 4, byteArray.length);
- assertEquals("a[0]", '0'.charCodeAt(0), byteArray[0]);
- assertEquals("a[1]", '1'.charCodeAt(0), byteArray[1])
- assertEquals("a[2]", '2'.charCodeAt(0), byteArray[2]);
- assertEquals("a[3]", '3'.charCodeAt(0), byteArray[3]);
- let ba = imports.byteArray.fromString("0123");
- GIMarshallingTests.bytearray_none_in(ba);
+ assertEquals(refByteArray.length, byteArray.length);
+ for (i = 0; i < refByteArray.length; i++)
+ assertEquals(refByteArray[i], byteArray[i]);
+ GIMarshallingTests.bytearray_none_in(refByteArray);
}
gjstestRun();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]