[Nice-commit] Nice/testsuite helpers.nice,1.2,1.3
Brought to you by:
bonniot
From: Artem Gr K. <ar...@us...> - 2005-08-29 11:05:28
|
Update of /cvsroot/nice/Nice/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31894/testsuite Modified Files: helpers.nice Log Message: Print the generated source on errors. Index: helpers.nice =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/helpers.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** helpers.nice 12 Apr 2005 13:57:32 -0000 1.2 --- helpers.nice 29 Aug 2005 11:05:19 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- */ + import nice.io; import nice.tools.compiler.console; import nice.tools.compiler; *************** *** 32,36 **** let File tmp = new File("temp-testcase"); ! void compile (String pkg, ?String toplevel = null, --- 33,46 ---- let File tmp = new File("temp-testcase"); ! class HelpersOutput extends nice.tools.compiler.console.ConsoleOutput { ! File source; ! error(location, message){ ! println( "8<-------------------------------------------------------------------------->8" ); ! println( read( source ) ); ! super; ! } ! } ! ! public File compile (String pkg, ?String toplevel = null, *************** *** 42,48 **** let dir = new File(tmp, dirname); dir.mkdirs(); ! writeProgram(new File(dir, "main.nice"), imp, toplevel, main, check); ! let output = consoleOutput(); let compilation = new bossa.modules.Compilation --- 52,59 ---- let dir = new File(tmp, dirname); dir.mkdirs(); ! let source = new File(dir, "main.nice"); ! writeProgram(source, imp, toplevel, main, check); ! let output = new HelpersOutput( source: source ); let compilation = new bossa.modules.Compilation *************** *** 52,60 **** compilation.packagePath = new File(tmp, imp + ".jar").toString(); compilation.runtimeFile = "classes"; ! compilation.output = new File(tmp, pkg + ".jar").toString(); compile(compilation, pkg); ! assert output.errorCount == 0; } --- 63,73 ---- compilation.packagePath = new File(tmp, imp + ".jar").toString(); compilation.runtimeFile = "classes"; ! let outputJar = new File(tmp, pkg + ".jar"); ! compilation.output = outputJar.getPath(); compile(compilation, pkg); ! !assert output.errorCount == 0; ! return outputJar; } *************** *** 83,92 **** } ! void run(String jar) { run(new java.io.File(tmp, jar + ".jar")); } ! void run(java.io.File jar) { let jarFile = new JarFile(jar); --- 96,105 ---- } ! public void run(String jar) { run(new java.io.File(tmp, jar + ".jar")); } ! public void run(java.io.File jar) { let jarFile = new JarFile(jar); |