Ticket #89: ticket89-files-arg.patch
File ticket89-files-arg.patch, 1.8 KB (added by hopscc, 16 years ago) |
---|
-
Source/CommandLine.cobra
1143 1143 validate names and add into fileList 1144 1144 """ 1145 1145 for fileName as String in fileNamesList 1146 baseDir = Path.getDirectoryName(fileName)1147 1146 try 1147 what = 'name "[fileName]"' 1148 baseDir = Path.getDirectoryName(fileName) 1148 1149 for line in File.readAllLines(fileName) 1149 1150 line = line.trim 1150 1151 if line.length==0 or line.startsWith('#') 1151 1152 continue 1152 1153 # note that source files are relative to the location of the "files file" 1153 _processAsFile(Path.combine(baseDir, line), fileList, nil) 1154 what = 'line - filename "[line]"' 1155 fileArg = Path.combine(baseDir, line) 1156 _processAsFile(fileArg, fileList, nil) 1154 1157 catch IOException 1155 1158 _error('Cannot open file "[fileName]".') 1159 catch ArgumentException 1160 _error('Invalid filesFile [what].') 1156 1161 1157 1162 def _processAsFile(arg as String, fileList as List<of String>, errHint as String?) 1158 1163 """ -
Tests/700-command-line/860-files.cobra
1 # check missing/weirded filesFiles arg 2 class Test 3 4 def main is shared 5 .check('-c -files:xyzzy', 'cannot open file "xyzzy"') 6 .check('-c -files: ', 'invalid filesfile name "".') 7 .check('-c -files:100-find-cobra.exe', 'invalid filesfile line - filename') 8 9 def check(opt as String, contains) is shared 10 process as System.Diagnostics.Process? 11 12 output = CobraCore.runCobraExe('[opt] ', out process) 13 assert output.toLower.contains(contains)