Skip to content

Commit

Permalink
refs #22: add - lua5 image test
Browse files Browse the repository at this point in the history
  • Loading branch information
adrysn committed Oct 22, 2016
1 parent 9fcfa53 commit 9c13d38
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def test_basic_failure(self):
self.assertIs(type(resp['exceptions']), list)
self.assertGreater(len(resp['exceptions']), 0)
err_name, err_arg = expected
self.assertRegex(resp['exceptions'][0][0], '^' + re.escape(err_name))
if 'kernel-lua' in self.image_name:
self.assertIn(err_name, resp['exceptions'][0][0])
else:
self.assertRegex(resp['exceptions'][0][0], '^' + re.escape(err_name))
if err_arg:
self.assertIn(err_arg, resp['exceptions'][0][1])
if inner_exception:
Expand Down Expand Up @@ -343,6 +346,20 @@ def basic_failure(self):
yield 'throw(ParseError("asdf"))', ('ParseError("asdf")', None)


class Lua5ImageTest(ImageTestBase, unittest.TestCase):

image_name = 'kernel-lua5'

def basic_success(self):
yield 'print("hello world")', 'hello world'
yield 'io.write("hello world")', 'hello world'
yield 'a = 1; b = 2; c = a + b; print(c)', '3'

def basic_failure(self):
yield 'print(some_undef_var)', ('nil', None)
yield 'error("test-error")', ('test-error', None)


class JailTest(ImageTestBase, unittest.TestCase):

image_name = 'kernel-python3'
Expand Down

0 comments on commit 9c13d38

Please sign in to comment.