[jsinterp] Fixing typos and code style
This commit is contained in:
parent
1f40e3ef63
commit
db0dc7b4ea
@ -9,8 +9,8 @@
|
||||
#
|
||||
# code: If missing subtest is skipped, Otherwise it's value is used as code to initialize the tested class.
|
||||
# globals: Optional. Used only by `test_jsinterp`. If set used as argument `variables` initializing `JSInterperter`.
|
||||
# asserts: Used only by `test_jsinterp`. If this is missing subtest is skipped, Should be a list of `dict`, each used
|
||||
# as an assertion for the initialized `JSInterpreter`. Each `dict` may have the following keys:
|
||||
# asserts: Used only by `test_jsinterp`. If this is missing subtest is skipped, Should be a list of `dict`, each
|
||||
# used as an assertion for the initialized `JSInterpreter`. Each `dict` may have the following keys:
|
||||
# value: If missing assertion is skipped. Otherwise it's value is used as expected value in
|
||||
# an `assertEqual` call.
|
||||
# call: Optional. If set used as arguments of a `call_function` call of the initialized `JSInterpreter`
|
||||
|
@ -24,7 +24,7 @@ tests = [
|
||||
'ast': [(Token.FUNC, 'x', [], [None])]
|
||||
},
|
||||
{
|
||||
# FIXME: function expresiion needs to be implemented
|
||||
# FIXME: function expression needs to be implemented
|
||||
'exclude': ('jsinterp2',),
|
||||
'code': 'var x5 = function x5(){return 42;}',
|
||||
'asserts': [{'value': 42, 'call': ('x5',)}]
|
||||
|
@ -42,7 +42,7 @@ tests = [
|
||||
# FIXME built-in functions not yet implemented
|
||||
'exclude': ('jsinterp2',),
|
||||
'code': 'function x(a) { return a.split(""); }',
|
||||
'asserts': [{'value': ["a", "b", "c"], 'call': ('x',"abc")}],
|
||||
'asserts': [{'value': ["a", "b", "c"], 'call': ('x', "abc")}],
|
||||
'ast': [
|
||||
(Token.FUNC, 'x', ['a'], [
|
||||
(Token.RETURN, (Token.EXPR, [
|
||||
|
@ -4,7 +4,7 @@ from youtube_dl.jsinterp2.jsgrammar import Token
|
||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
||||
|
||||
skip = {
|
||||
'jsinterp': 'Do loop is not supportted',
|
||||
'jsinterp': 'Do loop is not supported',
|
||||
'interpret': 'Interpreting do loop not yet implemented'
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,8 @@ tests = [
|
||||
(Token.MEMBER, (Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER, (Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER, (Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER, (Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER,
|
||||
(Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER,
|
||||
(Token.EXPR, [(Token.ASSIGN, None, (Token.OPEXPR, [
|
||||
(Token.MEMBER, (Token.INT, 3), None, None)
|
||||
|
@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
skip = {
|
||||
'jsinterp': 'Unary opertations are not supported',
|
||||
'jsinterp': 'Unary operations are not supported',
|
||||
'parse': True
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ from .base import (
|
||||
|
||||
|
||||
def _get_formal_args(func):
|
||||
return func.__code__.co_varnames[func.__code__.co_argcount - len((func.__defaults__))]
|
||||
return func.__code__.co_varnames[func.__code__.co_argcount - len(func.__defaults__)]
|
||||
|
||||
|
||||
def to_js(o, name=None):
|
||||
|
@ -156,7 +156,7 @@ class Parser(object):
|
||||
|
||||
elif token_value == 'debugger':
|
||||
self.token_stream.pop()
|
||||
statement = (Token.DEBUG)
|
||||
statement = (Token.DEBUG,)
|
||||
peek_id, peek_value, peek_pos = self.token_stream.peek()
|
||||
if peek_id is Token.END:
|
||||
self.token_stream.pop()
|
||||
@ -164,7 +164,7 @@ class Parser(object):
|
||||
# FIXME automatic end insertion
|
||||
raise ExtractorError('Unexpected sequence at %d' % peek_pos)
|
||||
else: # label
|
||||
# XXX possible refactoring (this is the only branch not poping)
|
||||
# XXX possible refactoring (this is the only branch not popping)
|
||||
token_id, token_value, token_pos = self.token_stream.peek(2)
|
||||
if token_id is Token.COLON:
|
||||
token_id, label_name, token_pos = self.token_stream.pop(2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user