about summary refs log tree commit diff
path: root/test/test_jsinterp.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-18 10:47:40 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-18 10:47:42 +0100
commit3eff81fbf72939abf885afcca2f1155cc976999b (patch)
tree6e6a48c9f37b4a217860b8f8986b0cf177fd2a37 /test/test_jsinterp.py
parent785521bf4fbd99b2916bdab5d847d84424196c1d (diff)
downloadyoutube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.tar.gz
youtube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.tar.xz
youtube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.zip
[jsinterp] Disable comment support
We need a proper lexer to be able to understand YouTube's code, which contains /* inside of strings.
For now it's sufficient to just disable comment support altogether.

Fixes #4976, fixes #4979, fixes #4980, fixes #4981, fixes #4982.
Closes #4977.
Diffstat (limited to 'test/test_jsinterp.py')
-rw-r--r--test/test_jsinterp.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py
index b91b8c492..fc73e5dc2 100644
--- a/test/test_jsinterp.py
+++ b/test/test_jsinterp.py
@@ -70,6 +70,8 @@ class TestJSInterpreter(unittest.TestCase):
         self.assertEqual(jsi.call_function('f'), -11)
 
     def test_comments(self):
+        'Skipping: Not yet fully implemented'
+        return
         jsi = JSInterpreter('''
         function x() {
             var x = /* 1 + */ 2;
@@ -80,6 +82,15 @@ class TestJSInterpreter(unittest.TestCase):
         ''')
         self.assertEqual(jsi.call_function('x'), 52)
 
+        jsi = JSInterpreter('''
+        function f() {
+            var x = "/*";
+            var y = 1 /* comment */ + 2;
+            return y;
+        }
+        ''')
+        self.assertEqual(jsi.call_function('f'), 3)
+
     def test_precedence(self):
         jsi = JSInterpreter('''
         function x() {