]> git.bitcoin.ninja Git - ldk-java/commitdiff
[TS] Remove race-y test for malloc-free-malloc re-using memory
authorMatt Corallo <git@bluematt.me>
Sat, 15 Jan 2022 21:46:20 +0000 (21:46 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 17 Jan 2022 04:34:51 +0000 (04:34 +0000)
ts/test/tests.mts

index 7c3716535f34f77e7e0789a45b646985333c1766..bbf2c8d111bf4ec197d18d23bcd804a54096ede1 100644 (file)
@@ -12,18 +12,11 @@ tests.push(async () => {
        console.assert(rawldk.CResult_boolLightningErrorZ_is_ok(result));
        console.assert(rawldk.CResult_boolLightningErrorZ_get_ok(result));
        rawldk.CResult_boolLightningErrorZ_free(result);
-       console.assert(rawldk.CResult_boolLightningErrorZ_ok(false) == result); // malloc doesn't need to guarantee this, but currently does
-       console.assert(rawldk.CResult_boolLightningErrorZ_is_ok(result));
-       console.assert(!rawldk.CResult_boolLightningErrorZ_get_ok(result));
-       rawldk.CResult_boolLightningErrorZ_free(result);
+       const second_res = rawldk.CResult_boolLightningErrorZ_ok(false);
+       console.assert(rawldk.CResult_boolLightningErrorZ_is_ok(second_res));
+       console.assert(!rawldk.CResult_boolLightningErrorZ_get_ok(second_res));
+       rawldk.CResult_boolLightningErrorZ_free(second_res);
 
-       /*var pk_arr = [];
-       for (var i = 0; i < 33; i++) { pk_arr[i] = 42; }
-       const pk_bytes = encodeUint8Array(pk_arr);
-       const pk_res = wasm.TS_CResult_PublicKeyErrorZ_ok(pk_bytes);
-       console.assert(wasm.TS_CResult_PublicKeyErrorZ_is_ok(pk_res));
-       const pk_res_bytes = wasm.TS_LDKCResult_PublicKeyErrorZ_get_ok(pk_res);
-       wasm.TS_CResult_PublicKeyErrorZ_free(pk_res);*/
        return true;
 });