@@ -10,14 +10,22 @@ Literal_Conversion: do {
10
10
. number( 0 ) ,
11
11
. number( Double ( Int32 . max) ) ,
12
12
. number( Double ( Int32 . min) ) ,
13
+ . number( Double . infinity) ,
14
+ . number( Double . nan) ,
13
15
. null,
14
16
. undefined,
15
17
]
16
18
for (index, input) in inputs. enumerated ( ) {
17
19
let prop = " prop_ \( index) "
18
20
setJSValue ( this: global, name: prop, value: input)
19
21
let got = getJSValue ( this: global, name: prop)
20
- try expectEqual ( got, input)
22
+ switch ( got, input) {
23
+ case let ( . number( lhs) , . number( rhs) ) :
24
+ // Compare bitPattern because nan == nan is always false
25
+ try expectEqual ( lhs. bitPattern, rhs. bitPattern)
26
+ default :
27
+ try expectEqual ( got, input)
28
+ }
21
29
}
22
30
} catch {
23
31
print ( error)
@@ -70,6 +78,10 @@ Object_Conversion: do {
70
78
Value_Construction: do {
71
79
let globalObject1 = getJSValue ( this: . global, name: " globalObject1 " )
72
80
let globalObject1Ref = try expectObject ( globalObject1)
81
+ let prop_2 = getJSValue ( this: globalObject1Ref, name: " prop_2 " )
82
+ try expectEqual ( Int . construct ( from: prop_2) , 2 )
83
+ let prop_3 = getJSValue ( this: globalObject1Ref, name: " prop_3 " )
84
+ try expectEqual ( Bool . construct ( from: prop_3) , true )
73
85
let prop_7 = getJSValue ( this: globalObject1Ref, name: " prop_7 " )
74
86
try expectEqual ( Double . construct ( from: prop_7) , 3.14 )
75
87
try expectEqual ( Float . construct ( from: prop_7) , 3.14 )
0 commit comments