aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-09-01 13:14:04 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-09-01 16:46:32 +0530
commit05deb747bb18febb803b47119ca7bc432ffb80c8 (patch)
tree9b282436508c7029073168418beca578ce2f8207 /test
parentb505e8517ad2ca8e07d5f9577dfd9a96165beaa0 (diff)
downloadhypervideo-pre-05deb747bb18febb803b47119ca7bc432ffb80c8.tar.lz
hypervideo-pre-05deb747bb18febb803b47119ca7bc432ffb80c8.tar.xz
hypervideo-pre-05deb747bb18febb803b47119ca7bc432ffb80c8.zip
[jsinterp] Fix escape in regex
Diffstat (limited to 'test')
-rw-r--r--test/test_jsinterp.py5
-rw-r--r--test/test_youtube_signature.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index 4b6e22bac..0cdf726fb 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -352,6 +352,11 @@ class TestJSInterpreter(unittest.TestCase):
''')
self.assertEqual(jsi.call_function('x').flags & re.I, re.I)
+ jsi = JSInterpreter('''
+ function x() { let a=/,][}",],()}(\[)/; return a; }
+ ''')
+ self.assertEqual(jsi.call_function('x').pattern, r',][}",],()}(\[)')
+
def test_char_code_at(self):
jsi = JSInterpreter('function x(i){return "test".charCodeAt(i)}')
self.assertEqual(jsi.call_function('x', 0), 116)
diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py
index 717c94954..b1c5cb2b3 100644
--- a/test/test_youtube_signature.py
+++ b/test/test_youtube_signature.py
@@ -122,6 +122,10 @@ _NSIG_TESTS = [
'https://www.youtube.com/s/player/113ca41c/player_ias.vflset/en_US/base.js',
'cgYl-tlYkhjT7A', 'hI7BBr2zUgcmMg',
),
+ (
+ 'https://www.youtube.com/s/player/c57c113c/player_ias.vflset/en_US/base.js',
+ 'M92UUMHa8PdvPd3wyM', '3hPqLJsiNZx7yA',
+ ),
]