From 86e4eb60b3e550dc13fcf62ffd83d2f8bdaf9b01 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Aug 2020 12:42:06 +0900 Subject: [PATCH 1/2] Add test case to check invalid terminator --- IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift | 2 +- IntegrationTests/bin/primary-tests.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift b/IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift index d2dffa26a..3c3e5deca 100644 --- a/IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift +++ b/IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift @@ -88,7 +88,7 @@ test("Array Iterator") { let prop_4 = getJSValue(this: globalObject1Ref, name: "prop_4") let array = try expectArray(prop_4) let expectedProp_4: [JSValue] = [ - .number(3), .number(4), .string("str_elm_1"), .number(5), + .number(3), .number(4), .string("str_elm_1"), .null, .undefined, .number(5), ] try expectEqual(Array(array), expectedProp_4) } diff --git a/IntegrationTests/bin/primary-tests.js b/IntegrationTests/bin/primary-tests.js index 3b4eda72a..094ee4854 100644 --- a/IntegrationTests/bin/primary-tests.js +++ b/IntegrationTests/bin/primary-tests.js @@ -5,7 +5,7 @@ global.globalObject1 = { "prop_2": 2, "prop_3": true, "prop_4": [ - 3, 4, "str_elm_1", 5, + 3, 4, "str_elm_1", null, undefined, 5, ], "prop_5": { "func1": function () { return }, @@ -41,4 +41,4 @@ const { startWasiTask } = require("../lib") startWasiTask("./dist/PrimaryTests.wasm").catch(err => { console.log(err) -}); \ No newline at end of file +}); From 99e3a786cc3919cc0477ade870b4593e5814f7b6 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 27 Aug 2020 12:44:53 +0900 Subject: [PATCH 2/2] Fix invalid array termination --- Sources/JavaScriptKit/JSArrayRef.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/JavaScriptKit/JSArrayRef.swift b/Sources/JavaScriptKit/JSArrayRef.swift index a84fb27d2..df3937b12 100644 --- a/Sources/JavaScriptKit/JSArrayRef.swift +++ b/Sources/JavaScriptKit/JSArrayRef.swift @@ -34,7 +34,7 @@ extension JSArrayRef: RandomAccessCollection { return nil } let value = ref[index] - return value.isNull ? nil : value + return value } }