mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-22 16:08:58 +00:00
@@ -445,6 +445,22 @@ class TestJSInterpreter(unittest.TestCase):
|
||||
jsi = JSInterpreter('function x(){return 1236566549 << 5}')
|
||||
self.assertEqual(jsi.call_function('x'), 915423904)
|
||||
|
||||
def test_negative(self):
|
||||
jsi = JSInterpreter("function f(){return 2 * -2.0;}")
|
||||
self.assertEqual(jsi.call_function('f'), -4)
|
||||
|
||||
jsi = JSInterpreter('function f(){return 2 - - -2;}')
|
||||
self.assertEqual(jsi.call_function('f'), 0)
|
||||
|
||||
jsi = JSInterpreter('function f(){return 2 - - - -2;}')
|
||||
self.assertEqual(jsi.call_function('f'), 4)
|
||||
|
||||
jsi = JSInterpreter('function f(){return 2 - + + - -2;}')
|
||||
self.assertEqual(jsi.call_function('f'), 0)
|
||||
|
||||
jsi = JSInterpreter('function f(){return 2 + - + - -2;}')
|
||||
self.assertEqual(jsi.call_function('f'), 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -142,6 +142,10 @@ _NSIG_TESTS = [
|
||||
'https://www.youtube.com/s/player/dac945fd/player_ias.vflset/en_US/base.js',
|
||||
'o8BkRxXhuYsBCWi6RplPdP', '3Lx32v_hmzTm6A',
|
||||
),
|
||||
(
|
||||
'https://www.youtube.com/s/player/6f20102c/player_ias.vflset/en_US/base.js',
|
||||
'lE8DhoDmKqnmJJ', 'pJTTX6XyJP2BYw',
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user