[jsinterp] Coding convention fixes
This commit is contained in:
parent
4999fcc646
commit
651a1e7aa8
@ -104,6 +104,7 @@ class TestJSInterpreter(unittest.TestCase):
|
|||||||
}''')
|
}''')
|
||||||
self.assertEqual(jsi.call_function('x'), [20, 20, 30, 40, 50])
|
self.assertEqual(jsi.call_function('x'), [20, 20, 30, 40, 50])
|
||||||
|
|
||||||
|
@unittest.skip('Interpreting function call not yet implemented')
|
||||||
def test_call(self):
|
def test_call(self):
|
||||||
jsi = JSInterpreter('''
|
jsi = JSInterpreter('''
|
||||||
function x() { return 2; }
|
function x() { return 2; }
|
||||||
@ -113,7 +114,9 @@ class TestJSInterpreter(unittest.TestCase):
|
|||||||
self.assertEqual(jsi.call_function('z'), 5)
|
self.assertEqual(jsi.call_function('z'), 5)
|
||||||
jsi = JSInterpreter('function x(a) { return a.split(""); }', objects={'a': 'abc'})
|
jsi = JSInterpreter('function x(a) { return a.split(""); }', objects={'a': 'abc'})
|
||||||
self.assertEqual(jsi.call_function('x'), ["a", "b", "c"])
|
self.assertEqual(jsi.call_function('x'), ["a", "b", "c"])
|
||||||
return
|
|
||||||
|
@unittest.skip('Interpreting function call not yet implemented')
|
||||||
|
def test_complex_call(self):
|
||||||
jsi = JSInterpreter('''
|
jsi = JSInterpreter('''
|
||||||
function a(x) { return x; }
|
function a(x) { return x; }
|
||||||
function b(x) { return x; }
|
function b(x) { return x; }
|
||||||
|
@ -504,7 +504,9 @@ class TestJSInterpreterParser(unittest.TestCase):
|
|||||||
self.assertEqual(jsi.call_function('z'), 5)
|
self.assertEqual(jsi.call_function('z'), 5)
|
||||||
jsi = JSInterpreter('function x(a) { return a.split(""); }', objects={'a': 'abc'})
|
jsi = JSInterpreter('function x(a) { return a.split(""); }', objects={'a': 'abc'})
|
||||||
self.assertEqual(jsi.call_function('x'), ["a", "b", "c"])
|
self.assertEqual(jsi.call_function('x'), ["a", "b", "c"])
|
||||||
return
|
|
||||||
|
@unittest.skip('Parsing function declaration not yet implemented')
|
||||||
|
def test_complex_call(self):
|
||||||
jsi = JSInterpreter('''
|
jsi = JSInterpreter('''
|
||||||
function a(x) { return x; }
|
function a(x) { return x; }
|
||||||
function b(x) { return x; }
|
function b(x) { return x; }
|
||||||
|
@ -16,7 +16,6 @@ from .jsgrammar import (
|
|||||||
Token
|
Token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
_PUNCTUATIONS = {
|
_PUNCTUATIONS = {
|
||||||
'{': Token.COPEN,
|
'{': Token.COPEN,
|
||||||
'}': Token.CCLOSE,
|
'}': Token.CCLOSE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user