From: Finn B. <bc...@us...> - 2001-11-21 11:10:46
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv11085 Added Files: test340.py test340c.py test340j.java Log Message: Test for [ #480390 ] main() does not throw exceptions. --- NEW FILE: test340.py --- """ [ #480390 ] main() does not throw exceptions """ import support support.compileJPythonc("test340c.py", core=1, jar="test340.jar", output="test340.err") support.compileJava("test340j.java") rc = support.runJava("test340j", classpath=".", expectError=1) if rc != 42: support.TestError("Did not catch exception correctly %d" % rc) --- NEW FILE: test340c.py --- import java.lang.Exception raise java.lang.Exception --- NEW FILE: test340j.java --- import java.net.*; import java.lang.reflect.*; public class test340j { public static void main(String[] args) { try { String jar = "./test340.jar"; URLClassLoader theLoader = new URLClassLoader(new URL[] { new URL("file:" + jar)}); Object theLoadedClass = Class.forName("test340c", true, theLoader). newInstance(); String[] array = new String[] {}; Method main = theLoadedClass.getClass(). getMethod("main", new Class[] { array.getClass() }); main.invoke(theLoadedClass, new Object[] {new String[] {}}); } catch (Throwable t) { System.exit(42); } System.exit(43); } } |