Ticket #141: ticket141-turbo-plus1.patch
File ticket141-turbo-plus1.patch, 9.0 KB (added by hopscc, 15 years ago) |
---|
-
Source/CommandLine.cobra
63 63 return not CobraCore.isRunningOnMono 64 64 return false 65 65 66 def hasBoolTrue(name as String) as bool 67 """ 68 Contains key of name and value is boolean true 69 """ 70 return .containsKey(name) and (this[name] to bool) 71 66 72 def unpack 67 73 _name = this['name'] to String 68 74 try … … 445 451 }, 446 452 { 447 453 'name': 'turbo', 448 'description': ' Maximumrun-time performance. This is a convenience for -contracts:none -include-asserts:no -include-nil-checks:no -include-tests:no -include-traces:no -optimize',454 'description': 'Build to maximize run-time performance. This is a convenience for -contracts:none -include-asserts:no -include-nil-checks:no -include-tests:no -include-traces:no -optimize', 449 455 'type': 'bool', 456 'composite': true, 450 457 }, 451 458 { 452 459 'name': 'verbosity', … … 792 799 for spec in CommandLineOptionSpecs().specsList 793 800 if spec.containsKey('type') and spec['type']=='main' # CC: spec.get('main', '') 794 801 continue 795 if spec. containsKey('developer-only') and spec['developer-only'] to booland not Utils.isDevMachine802 if spec.hasBoolTrue('developer-only')and not Utils.isDevMachine 796 803 continue 797 804 if spec.isOptionSpecRestrictionViolated 798 805 continue … … 1039 1046 continue 1040 1047 1041 1048 value = _processToValue(name, valueStr, spec, mainOptions) 1042 if value == 'args-list' 1043 value = args[argn:] 1044 if value is nil 1045 errMsg = 'Cannot parse value "[valueStr]" for option "[name]".' 1046 branch spec.type 1047 on 'bool', errMsg += ' Possible values include yes, no, y, n, true, false, t, f, 1, 0, + and -.' 1048 on 'menu', errMsg += ' Possible values are [spec.choices.join(", ", " and ")].' 1049 _error(errMsg) 1050 valueDict[name] = value to ! 1051 didSpecify[name] = true 1049 if value == 'args-list', value = args[argn:] # remainder of argslist 1050 if value is nil 1051 _emitArgsParseError(name, valueStr, spec) 1052 _setArgComposite(name, value to !, spec, valueDict, didSpecify) 1052 1053 if spec.type == 'args-list' 1053 1054 break # absorbed remainder of args 1054 1055 else # not isOption … … 1062 1063 _addInDefaults(valueDict) 1063 1064 1064 1065 # TODO: make the option names case-insensitive 1065 1066 1066 if mainOptions.count > 1 1067 1067 _error('Cannot have these main options at the same time: [mainOptions.join(", ")]') 1068 1068 … … 1157 1157 if valueDict.containsKey(name) 1158 1158 (valueDict[name] to System.Collections.IList).add(value) 1159 1159 else 1160 valueDict[name] = [value to String] 1161 didSpecify[name] = true 1160 _setArg(name, [value to String], valueDict, didSpecify) 1162 1161 1162 def _setArg(name as String, value as dynamic, 1163 valueDict as Dictionary<of String, Object>, 1164 didSpecify as Dictionary<of String, bool>) 1165 valueDict[name] = value 1166 didSpecify[name] = true 1167 1163 1168 def _fixDebug(valueStr as String) as String? 1164 1169 if valueStr == 'pdbonly' or valueStr == 'full' 1165 1170 return valueStr … … 1189 1194 value = _interpretValue(valueStr, spec) 1190 1195 return value 1191 1196 1197 def _emitArgsParseError(name as String, valueStr as String, spec as OptionSpec) 1198 errMsg = 'Cannot parse value "[valueStr]" for option "[name]".' 1199 branch spec.type 1200 on 'bool', errMsg += ' Possible values include yes, no, y, n, true, false, t, f, 1, 0, + and -.' 1201 on 'menu', errMsg += ' Possible values are [spec.choices.join(", ", " and ")].' 1202 _error(errMsg) 1203 1204 def _setArgComposite(name as String, value, spec as OptionSpec, 1205 valueDict as Dictionary<of String, Object>, 1206 didSpecify as Dictionary<of String, bool>) 1207 if spec.hasBoolTrue('composite') 1208 branch name 1209 on 'turbo' 1210 _setArg('contracts', 'none', valueDict, didSpecify) 1211 _setArg('include-asserts', false, valueDict, didSpecify) 1212 _setArg('include-nil-checks', false, valueDict, didSpecify) 1213 _setArg('include-tests', false, valueDict, didSpecify) 1214 _setArg('include-traces', false, valueDict, didSpecify) 1215 _setArg('optimize', true, valueDict, didSpecify) 1216 else 1217 _error('Unknown composite arg "[name]"') 1218 else 1219 _setArg(name, value to !, valueDict, didSpecify) 1220 1192 1221 def _handleSynonyms(valueDict as Dictionary<of String, Object>) 1193 1222 for syn in _synList 1194 1223 if valueDict.containsKey(syn) … … 1271 1300 options['compile'] = true 1272 1301 if options.getDefault('debug', '') not in ['', '0', '-'] and not options.isSpecified('debugging-tips') 1273 1302 options['debugging-tips'] = false 1274 if options.boolValue('turbo') 1275 options['contracts'] = 'none' 1276 options['include-asserts'] = false 1277 options['include-nil-checks'] = false 1278 options['include-tests'] = false 1279 options['include-traces'] = false 1280 options['optimize'] = true 1281 1303 1282 1304 def _interpretValue(valueStr as String, spec as OptionSpec) as dynamic? 1283 1305 value as dynamic? 1284 1306 branch spec.type -
Tests/700-command-line/603-turbo-plus.cobra
1 # test -turbo with suboptions overidden, 2 # test that options are LtoR order dependant 3 4 use System.Diagnostics 5 6 class Test 7 8 def main is shared 9 Test().runOverride 10 Test().runTurboAfter 11 12 def runOverride 13 sub = '603a-sub.cobra' 14 ite = '-include-tests:yes' 15 itr = '-include-traces:yes' 16 ia = '-include-asserts:yes' 17 18 output = .runCobraExe('-turbo [sub]') 19 try 20 assert '** Test' not in output 21 assert 'trace:' not in output 22 assert 'AssertException' not in output 23 assert 'OKThxBai' in output 24 success 25 print '-turbo OK' 26 27 output = .runCobraExe('-turbo [ite] [sub]') 28 try 29 assert '** Test' in output 30 assert 'trace:' not in output 31 assert 'AssertException' not in output 32 assert 'OKThxBai' in output 33 success 34 print '-turbo [ite] OK' 35 36 output = .runCobraExe('-turbo [itr] [sub]') 37 try 38 assert '** Test' not in output 39 assert 'trace: a=99;' in output 40 assert 'AssertException' not in output 41 assert 'OKThxBai' in output 42 success 43 print '-turbo [itr] OK' 44 45 output = .runCobraExe('-turbo [ia] [sub]') 46 try 47 assert '** Test' not in output 48 assert 'trace:' not in output 49 assert 'AssertException thrown' in output 50 assert 'OKThxBai' in output 51 success 52 print '-turbo [ia] OK' 53 54 output = .runCobraExe('-turbo [ia] [itr] [ite] [sub]') 55 try 56 assert '** Test' in output 57 assert 'trace:' in output 58 assert 'AssertException thrown' in output 59 assert 'OKThxBai' in output 60 success 61 print '-turbo [ia] [itr] [ite] OK' 62 63 def runTurboAfter 64 sub = '603a-sub.cobra' 65 ite = '-include-tests:yes' 66 itr = '-include-traces:yes' 67 ia = '-include-asserts:yes' 68 69 output = .runCobraExe('[ia] [itr] [ite] -turbo [sub]') 70 try 71 assert '** Test' not in output 72 assert 'trace:' not in output 73 assert 'AssertException thrown' not in output 74 assert 'OKThxBai' in output 75 success 76 print '[ia] [itr] [ite] -turbo OK' 77 78 output = .runCobraExe('[ia] [itr] [ite] -turbo [ia] [sub]') 79 try 80 assert '** Test' not in output 81 assert 'trace:' not in output 82 assert 'AssertException thrown' in output 83 assert 'OKThxBai' in output 84 success 85 print '[ia] [itr] [ite] -turbo [ia] OK' 86 87 output = .runCobraExe('[ia] [itr] [ite] -turbo [ia] [itr] [sub]') 88 try 89 assert '** Test' not in output 90 assert 'trace:' in output 91 assert 'AssertException thrown' in output 92 assert 'OKThxBai' in output 93 success 94 print '[ia] [itr] [ite] -turbo [ia] [itr] OK' 95 96 97 def runCobraExe(args as String) as String 98 p as System.Diagnostics.Process? 99 return CobraCore.runCobraExe(args, out p) -
Tests/700-command-line/603a-sub.cobra
1 # .skip. 2 # executed by 603-turbo-plus 3 class Test 4 def main is shared 5 test 6 print '** Test' 7 body 8 a = 99 9 trace a 10 print 'OKThxBai' 11 try 12 assert a == 100 13 catch AssertException 14 print 'AssertException thrown' -
Developer/IntermediateReleaseNotes.text
404 404 * Fixed: Numeric for expression broken for `get` expressions with types other than `int` ticket:158 405 405 406 406 * Fixed: Operators `?` and `?=` give error if left hand expression is not nilable. ticket:117 407 408 * Fixed: Cannot effectively put more options after -turbo. ticket:141