Commit 3faa13ab authored by Stefan Marr's avatar Stefan Marr

Added work-around for use of exit()

- the same as for SOM and TruffleSOM
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent c524f892
......@@ -22,7 +22,7 @@ import sys
class Universe(object):
def __init__(self):
def __init__(self, avoid_exit = False):
self._interpreter = Interpreter(self)
self._symbol_table = SymbolTable()
......@@ -49,6 +49,7 @@ class Universe(object):
self._doubleClass = None
self._last_exit_code = 0
self._avoid_exit = avoid_exit
self._classpath = None
self._dump_bytecodes = False
......@@ -124,6 +125,15 @@ class Universe(object):
def metaclassClass(self):
return self._metaclassClass
def exit(self, error_code):
if self._avoid_exit:
self._last_exit_code = error_code
else:
sys.exit(error_code)
def last_exit_code(self):
return self._last_exit_code
def get_interpreter(self):
return self._interpreter
......
......@@ -28,7 +28,7 @@ class SomTest(unittest.TestCase):
("Vector" ,)])
def test_som_test(self, test_name):
args = ["-cp", "Smalltalk", "TestSuite/TestHarness.som", test_name]
u = Universe()
u = Universe(True)
u.interpret(args)
self.assertEquals(0, u.last_exit_code)
self.assertEquals(0, u.last_exit_code())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment