Skip to content

Commit fab45e1

Browse files
Fix test cases
1 parent d64def7 commit fab45e1

File tree

1 file changed

+8
-4
lines changed
  • IntegrationTests/TestSuites/Sources/PrimaryTests

1 file changed

+8
-4
lines changed

IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,18 @@ try test("Closure Identifiers") {
343343
}
344344

345345
func checkArray<T>(_ array: [T]) throws where T: TypedArrayElement {
346-
try expectEqual(JSTypedArray(array).toString!(), .string(jsStringify(array)))
346+
try expectEqual(toString(JSTypedArray(array).jsValue().object!), jsStringify(array))
347+
}
348+
349+
func toString<T: JSObject>(_ object: T) -> String {
350+
return object.toString!().string!
347351
}
348352

349353
func jsStringify(_ array: [Any]) -> String {
350354
array.map({ String(describing: $0) }).joined(separator: ",")
351355
}
352356

353-
test("TypedArray") {
357+
try test("TypedArray") {
354358
let numbers = [UInt8](0 ... 255)
355359
let typedArray = JSTypedArray(numbers)
356360
try expectEqual(typedArray[12], 12)
@@ -380,13 +384,13 @@ test("TypedArray") {
380384
}
381385
}
382386

383-
test("TypedArray_Mutation") {
387+
try test("TypedArray_Mutation") {
384388
let array = JSTypedArray<Int>(length: 100)
385389
for i in 0..<100 {
386390
array[i] = i
387391
}
388392
for i in 0..<100 {
389393
try expectEqual(i, array[i])
390394
}
391-
try expectEqual(array.toString!(), .string(jsStringify(Array(0..<100))))
395+
try expectEqual(toString(array.jsValue().object!), jsStringify(Array(0..<100)))
392396
}

0 commit comments

Comments
 (0)