@@ -212,9 +212,16 @@ def test_Date(self):
212
212
# undefined
213
213
self ._test (jsi , NaN , args = [JS_Undefined ])
214
214
# y,m,d, ... - may fail with older dates lacking DST data
215
- jsi = JSInterpreter ('function f() { return new Date(%s); }'
216
- % ('2024, 5, 29, 2, 52, 12, 42' ,))
217
- self ._test (jsi , 1719625932042 )
215
+ jsi = JSInterpreter (
216
+ 'function f() { return new Date(%s); }'
217
+ % ('2024, 5, 29, 2, 52, 12, 42' ,))
218
+ self ._test (jsi , (
219
+ 1719625932042 # UK value
220
+ + (
221
+ + 3600 # back to GMT
222
+ + (time .altzone if time .daylight # host's DST
223
+ else time .timezone )
224
+ ) * 1000 ))
218
225
# no arg
219
226
self .assertAlmostEqual (JSInterpreter (
220
227
'function f() { return new Date() - 0; }' ).call_function ('f' ),
@@ -485,6 +492,14 @@ def test_bitwise_operators_typecast(self):
485
492
self ._test ('function f(){return NaN << 42}' , 0 )
486
493
self ._test ('function f(){return "21.9" << 1}' , 42 )
487
494
self ._test ('function f(){return 21 << 4294967297}' , 42 )
495
+ self ._test ('function f(){return true << "5";}' , 32 )
496
+ self ._test ('function f(){return true << true;}' , 2 )
497
+ self ._test ('function f(){return "19" & "21.9";}' , 17 )
498
+ self ._test ('function f(){return "19" & false;}' , 0 )
499
+ self ._test ('function f(){return "11.0" >> "2.1";}' , 2 )
500
+ self ._test ('function f(){return 5 ^ 9;}' , 12 )
501
+ self ._test ('function f(){return 0.0 << NaN}' , 0 )
502
+ self ._test ('function f(){return null << undefined}' , 0 )
488
503
489
504
def test_negative (self ):
490
505
self ._test ('function f(){return 2 * -2.0 ;}' , - 4 )
0 commit comments