Ticket #239: test-and-out.patch
File test-and-out.patch, 4.1 KB (added by hopscc, 12 years ago) |
---|
-
Source/CommandLine.cobra
901 901 p.start 902 902 p.waitForExit # TODO: is this necessary? 903 903 catch 904 try, File.delete(c.fullExeFileName) 905 catch IOException, pass 906 catch UnauthorizedAccessException, pass 904 if not .options.getDefault('keep-intermediate-files', 0) 905 _cleanupExeFile(c.fullExeFileName, '') 907 906 throw 908 907 success 909 try 910 File.delete(c.fullExeFileName) 911 catch IOException 912 print 'warning: Cannot remove "[c.fullExeFileName]"' 913 catch UnauthorizedAccessException 914 print 'warning: Cannot remove "[c.fullExeFileName]"' 915 908 if not .options.getDefault('keep-intermediate-files', 0) 909 _cleanupExeFile(c.fullExeFileName, 'warning: Cannot remove "[c.fullExeFileName]"') 910 911 def _cleanupExeFile(fullExeFileName as String, msg as String) 912 try 913 File.delete(fullExeFileName) 914 dbgExeFileName = Path.changeExtension(fullExeFileName, 'pdb') 915 if File.exists(dbgExeFileName), File.delete(dbgExeFileName) 916 catch IOException 917 if msg.length, print msg 918 catch UnauthorizedAccessException 919 if msg.length, print msg 920 921 916 922 def doRun(paths as List<of String>) 917 923 c = .doCompile(paths, false, false, nil) 918 924 if c.errors.count -
Source/BackEndClr/SharpGenerator.cobra
45 45 46 46 def writeSharpTestInvocation 47 47 dt = DateTime.now 48 fileName = 'test-[dt.year][dt.month][dt.day][dt.hour][dt.minute].cs' # TODO: format the numbers to have leading zeros 48 fileName = 'test-[dt.year][dt.month:D2][dt.day:D2][dt.hour:D2][dt.minute:D2].cs' 49 outName = .options.getDefault('out', '') 50 if outName.length 51 outDir = Path.getDirectoryName(outName) 52 if outDir.length, fileName = Path.combine(outDir, fileName) 53 49 54 w = CodePoundLineWriter() 50 55 w.writeLine('using CobraCoreInternal = Cobra.Core[.embedRunTimeSuffix];') 51 56 w.writeLine('') … … 94 99 outName = _modules.last.sharpFileName 95 100 else if .options.containsKey('out') 96 101 outName = .options.getDefault('out', '') 102 if outName.length and not Path.getFileName(outName).length # no filename, assume just a dirname given 103 outName = Path.combine(outName, .defaultOutName to !) 97 104 if outName == '', outName = .defaultOutName to ! 98 105 if outName.endsWith('.cs') or outName.endsWith('.CS'), outName = outName[:-3] 99 106 if outName.endsWith('.cobra') or outName.endsWith('.COBRA'), outName = outName[:-6] -
Source/BackEndClr/ScanClrType.cobra
496 496 isSameNativeType = argClrType == thisClrType 497 497 for methInfo in argClrType.getMethods(BindingFlags(DeclaredOnly, Static, Instance, Public)) 498 498 if methInfo.isSpecialName, continue 499 if methInfo.name.startsWith('test_'), continue # ignore cobra-inserted static test methods 499 500 # print 500 501 # print '--', methInfo, methInfo.isStatic 501 502 name = Utils.cobraNameForNativeMemberName(methInfo.name) -
Source/BackEndJvm/JavaGenerator.cobra
28 28 outName = _modules.last.javaFileName 29 29 else if .options.containsKey('out') 30 30 outName = .options.getDefault('out', '') 31 if outName.length and not Path.getFileName(outName).length # no filename, assume just a dirname given 32 outName = Path.combine(outName, .defaultOutName to !) 31 33 if outName == '', outName = .defaultOutName to ! 32 34 if outName.endsWith('.java') or outName.endsWith('.JAVA'), outName = outName[:-5] 33 35 if outName.endsWith('.cobra') or outName.endsWith('.COBRA'), outName = outName[:-6]