[pypy-svn] r48158 - pypy/dist/pypy/translator/llvm/test
santagada at codespeak.net
santagada at codespeak.net
Mon Oct 29 16:03:03 CET 2007
Author: santagada
Date: Mon Oct 29 16:03:00 2007
New Revision: 48158
Modified:
pypy/dist/pypy/translator/llvm/test/runtest.py
pypy/dist/pypy/translator/llvm/test/test_rlist.py
Log:
run things like jstest... and removed some commented out code.
Modified: pypy/dist/pypy/translator/llvm/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/runtest.py (original)
+++ pypy/dist/pypy/translator/llvm/test/runtest.py Mon Oct 29 16:03:00 2007
@@ -111,22 +111,22 @@
# XXX Work in progress, this was mostly copied from JsTest
class LLVMTest(BaseRtypingTest, LLRtypeMixin):
def _compile(self, _fn, args, policy=None):
- # argnames = _fn.func_code.co_varnames[:_fn.func_code.co_argcount]
- # func_name = _fn.func_name
- # if func_name == '<lambda>':
- # func_name = 'func'
- # source = py.code.Source("""
- # def %s():
- # from pypy.rlib.nonconst import NonConstant
- # res = _fn(%s)
- # if isinstance(res, type(None)):
- # return None
- # else:
- # return str(res)"""
- # % (func_name, ",".join(["%s=NonConstant(%r)" % (name, i) for
- # name, i in zip(argnames, args)])))
- # exec source.compile() in locals()
- return compile_function(_fn, [])
+ argnames = _fn.func_code.co_varnames[:_fn.func_code.co_argcount]
+ func_name = _fn.func_name
+ if func_name == '<lambda>':
+ func_name = 'func'
+ source = py.code.Source("""
+ def %s():
+ from pypy.rlib.nonconst import NonConstant
+ res = _fn(%s)
+ if isinstance(res, type(None)):
+ return None
+ else:
+ return str(res)"""
+ % (func_name, ",".join(["%s=NonConstant(%r)" % (name, i) for
+ name, i in zip(argnames, args)])))
+ exec source.compile() in locals()
+ return compile_function(locals()[func_name], [])
def interpret(self, fn, args, policy=None):
f = self._compile(fn, args)
@@ -139,33 +139,12 @@
#import pdb; pdb.set_trace()
try:
res = self.interpret(fn, args)
- except JSException, e:
- s = e.args[0]
- assert s.startswith('uncaught exception:')
- assert re.search(exception.__name__, s)
+ except Exception, e:
+ assert issubclass(eval(ex.class_name), exception)
else:
raise AssertionError("Did not raise, returned %s" % res)
#except ExceptionWrapper, ex:
# assert issubclass(eval(ex.class_name), exception)
#else:
# assert False, 'function did raise no exception at all'
- #
- # def ll_to_string(self, s):
- # return str(s)
- #
- # def ll_to_list(self, l):
- # return l
- #
- # def ll_unpack_tuple(self, t, length):
- # assert len(t) == length
- # return tuple(t)
- #
- # def class_name(self, value):
- # return value[:-8].split('.')[-1]
- #
- # def is_of_instance_type(self, val):
- # m = re.match("^<.* object>$", val)
- # return bool(m)
- #
- # def read_attr(self, obj, name):
- # py.test.skip('read_attr not supported on genjs tests')
+
Modified: pypy/dist/pypy/translator/llvm/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_rlist.py (original)
+++ pypy/dist/pypy/translator/llvm/test/test_rlist.py Mon Oct 29 16:03:00 2007
@@ -5,4 +5,4 @@
# ====> ../../../rpython/test/test_rlist.py
class TestLLVMList(LLVMTest, BaseTestRlist):
- pass
\ No newline at end of file
+ pass
More information about the Pypy-commit
mailing list