[jsinterp] Parser test code fixes
This commit is contained in:
parent
c2e6ca5432
commit
ad288aaabd
@ -637,9 +637,9 @@ class TestJSInterpreterParser(unittest.TestCase):
|
|||||||
'''
|
'''
|
||||||
function a(x) {
|
function a(x) {
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return true
|
return true;
|
||||||
else
|
else
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
@ -650,8 +650,8 @@ class TestJSInterpreterParser(unittest.TestCase):
|
|||||||
'''
|
'''
|
||||||
function a(x) {
|
function a(x) {
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return true
|
return true;
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
@ -681,22 +681,24 @@ class TestJSInterpreterParser(unittest.TestCase):
|
|||||||
ast = []
|
ast = []
|
||||||
self.assertEqual(list(jsi.statements()), ast)
|
self.assertEqual(list(jsi.statements()), ast)
|
||||||
|
|
||||||
@unittest.skip('Test not yet implemented: missing code and ast')
|
@unittest.skip('Test not yet implemented: missing ast')
|
||||||
def test_switch(self):
|
def test_switch(self):
|
||||||
# TODO switch test
|
# TODO switch test
|
||||||
jsi = JSInterpreter(
|
jsi = JSInterpreter(
|
||||||
'''
|
'''
|
||||||
function a(x) {
|
function a(x) {
|
||||||
switch (x) {
|
switch (x) {
|
||||||
case x == 6:
|
case 6:
|
||||||
break;
|
break;
|
||||||
case x > 5:
|
case 5:
|
||||||
x++;
|
x++;
|
||||||
case x == 6:
|
case 8:
|
||||||
x--;
|
x--;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user