[Nice-commit] Nice/src/nice/tools/unit/console main.nice,1.5,1.6
                
                Brought to you by:
                
                    bonniot
                    
                
            
            
        
        
        
    | 
     
      
      
      From: Daniel B. <bo...@us...> - 2005-04-08 08:27:05
      
     
   | 
Update of /cvsroot/nice/Nice/src/nice/tools/unit/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6093/src/nice/tools/unit/console Modified Files: main.nice Log Message: Added niceunit --jar Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/unit/console/main.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** main.nice 11 Mar 2005 17:35:48 -0000 1.5 --- main.nice 8 Apr 2005 08:26:57 -0000 1.6 *************** *** 16,19 **** --- 16,21 ---- ?String classpath = null; + ?String jar = null; + prg.options = [ *************** *** 23,26 **** --- 25,33 ---- String path => { classpath = path; }), + option("jar", + "An archive containing the program to test\nIts main package will be tested by default", + "path", + String opt => { jar = opt; }), + option("man", "Print man page to stdout", visible: false, () => man(prg)) *************** *** 29,35 **** List<String> rest = parse(prg, args); ! if (rest.size() == 0) prg.usage(); rest.foreach(String pkg => { if (! runTests(pkg, listener, classpath)) --- 36,53 ---- List<String> rest = parse(prg, args); ! if (rest.size() == 0 && jar == null) prg.usage(); + if (jar != null) + { + if (classpath == null) + classpath = jar; + else + classpath = notNull(jar) + java.io.File.pathSeparator + classpath; + + if (rest.size() == 0) + rest = [ mainPackage(notNull(jar)) ]; + } + rest.foreach(String pkg => { if (! runTests(pkg, listener, classpath)) *************** *** 38,41 **** --- 56,65 ---- } + String mainPackage(String jar) + { + String mainClass = new java.util.jar.JarFile(new java.io.File(jar)).getManifest().getMainAttributes().getValue("Main-Class"); + return mainClass.substring(0, mainClass.lastIndexOf('.')); + } + let Listener listener = new Listener();  |