summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:24:34 +0000
commitc94c26ea350ce21e663a84b0177aedce9cd93bb8 (patch)
tree9de0d239b35411e1fa6feaf05e26b3f4483adad2 /test
parentAdding debian version 2024.08.01-1. (diff)
downloadyt-dlp-c94c26ea350ce21e663a84b0177aedce9cd93bb8.tar.xz
yt-dlp-c94c26ea350ce21e663a84b0177aedce9cd93bb8.zip
Merging upstream version 2024.08.06.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rw-r--r--test/test_jsinterp.py28
-rw-r--r--test/test_youtube_signature.py4
2 files changed, 32 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index df92c83..06840ed 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -403,6 +403,34 @@ class TestJSInterpreter(unittest.TestCase):
self._test(jsi, [''], args=['', '-'])
self._test(jsi, [], args=['', ''])
+ def test_slice(self):
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice()}', [0, 1, 2, 3, 4, 5, 6, 7, 8])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(0)}', [0, 1, 2, 3, 4, 5, 6, 7, 8])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(5)}', [5, 6, 7, 8])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(99)}', [])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(-2)}', [7, 8])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(-99)}', [0, 1, 2, 3, 4, 5, 6, 7, 8])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(0, 0)}', [])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(1, 0)}', [])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(0, 1)}', [0])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(3, 6)}', [3, 4, 5])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(1, -1)}', [1, 2, 3, 4, 5, 6, 7])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(-1, 1)}', [])
+ self._test('function f(){return [0, 1, 2, 3, 4, 5, 6, 7, 8].slice(-3, -1)}', [6, 7])
+ self._test('function f(){return "012345678".slice()}', '012345678')
+ self._test('function f(){return "012345678".slice(0)}', '012345678')
+ self._test('function f(){return "012345678".slice(5)}', '5678')
+ self._test('function f(){return "012345678".slice(99)}', '')
+ self._test('function f(){return "012345678".slice(-2)}', '78')
+ self._test('function f(){return "012345678".slice(-99)}', '012345678')
+ self._test('function f(){return "012345678".slice(0, 0)}', '')
+ self._test('function f(){return "012345678".slice(1, 0)}', '')
+ self._test('function f(){return "012345678".slice(0, 1)}', '0')
+ self._test('function f(){return "012345678".slice(3, 6)}', '345')
+ self._test('function f(){return "012345678".slice(1, -1)}', '1234567')
+ self._test('function f(){return "012345678".slice(-1, 1)}', '')
+ self._test('function f(){return "012345678".slice(-3, -1)}', '67')
+
if __name__ == '__main__':
unittest.main()
diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py
index d37df7a..0f7ae34 100644
--- a/test/test_youtube_signature.py
+++ b/test/test_youtube_signature.py
@@ -179,6 +179,10 @@ _NSIG_TESTS = [
'https://www.youtube.com/s/player/20dfca59/player_ias.vflset/en_US/base.js',
'-fLCxedkAk4LUTK2', 'O8kfRq1y1eyHGw',
),
+ (
+ 'https://www.youtube.com/s/player/b12cc44b/player_ias.vflset/en_US/base.js',
+ 'keLa5R2U00sR9SQK', 'N1OGyujjEwMnLw',
+ ),
]