mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-14 02:27:42 -07:00
[JSInterp] Improve unary operators; add !
This commit is contained in:
parent
16b7e97afa
commit
bd2ded59f2
2 changed files with 13 additions and 3 deletions
|
@ -371,6 +371,13 @@ class TestJSInterpreter(unittest.TestCase):
|
|||
self._test('function f() { a=5; return (a -= 1, a+=3, a); }', 7)
|
||||
self._test('function f() { return (l=[0,1,2,3], function(a, b){return a+b})((l[1], l[2]), l[3]) }', 5)
|
||||
|
||||
def test_not(self):
|
||||
self._test('function f() { return ! undefined; }', True)
|
||||
self._test('function f() { return !0; }', True)
|
||||
self._test('function f() { return !!0; }', False)
|
||||
self._test('function f() { return ![]; }', False)
|
||||
self._test('function f() { return !0 !== false; }', True)
|
||||
|
||||
def test_void(self):
|
||||
self._test('function f() { return void 42; }', JS_Undefined)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue