Changeset 29
- Timestamp:
- Aug 19, 2006, 8:27:44 PM (19 years ago)
- Location:
- trunk/NewView
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NewView/CmdLineParameterUnit.pas
r28 r29 325 325 STATE_INSIDE_QUOTED = 3; 326 326 STATE_INSIDE_QUOTED_START_QUOTE = 4; 327 // STATE_INSIDE_QUOTED_QUOTE_PROCESSED = 5; 327 328 VAR 328 329 i : Integer; … … 377 378 begin 378 379 tmpState := STATE_INSIDE_QUOTED; 379 tmpCurrentCommand := tmpCurrentCommand + tmpCurrentChar; 380 end; 380 // tmpState := STATE_INSIDE_QUOTED_QUOTE_PROCESSED; 381 tmpCurrentCommand := tmpCurrentCommand + tmpCurrentChar; 382 end; 383 // STATE_INSIDE_QUOTED_QUOTE_PROCESSED : 384 // tmpState := STATE_INSIDE_QUOTED_START_QUOTE; 381 385 ELSE 382 386 tmpState := STATE_START_QUOTE; … … 410 414 tmpCurrentCommand := tmpCurrentCommand + tmpCurrentChar; 411 415 end; 416 // STATE_INSIDE_QUOTED_QUOTE_PROCESSED : 417 // begin 418 // tmpCurrentCommand := tmpCurrentCommand + tmpCurrentChar; 419 // end; 412 420 end; 413 421 end; … … 421 429 aResult.add(tmpCurrentCommand); 422 430 end; 431 STATE_START_QUOTE : 432 begin 433 result := ERROR_UNMATCHED_QUOTE; 434 end; 423 435 STATE_INSIDE_QUOTED_START_QUOTE : 424 436 begin 425 aResult.add(tmpCurrentCommand); 437 if (0 < length(tmpCurrentCommand)) then 438 begin 439 aResult.add(tmpCurrentCommand); 440 end; 426 441 end; 442 STATE_INSIDE_QUOTED : 443 begin 444 result := ERROR_UNMATCHED_QUOTE; 445 if (0 < length(tmpCurrentCommand)) then 446 begin 447 aResult.add(tmpCurrentCommand); 448 end; 449 end; 450 // STATE_INSIDE_QUOTED_QUOTE_PROCESSED : 451 // begin 452 // result := ERROR_UNMATCHED_QUOTE; 453 // if (1 < length(tmpCurrentCommand)) then 454 // begin 455 // aResult.add(copy(tmpCurrentCommand, 1, length(tmpCurrentCommand)-0)); 456 // end 457 // end; 427 458 ELSE 428 459 begin 429 460 result := ERROR_UNMATCHED_QUOTE; 430 aResult.add(tmpCurrentCommand); 461 if (0 < length(tmpCurrentCommand)) then 462 begin 463 aResult.add(tmpCurrentCommand); 464 end; 431 465 end; 432 466 end; -
trunk/NewView/NewView.spr
r28 r29 209 209 File0.Bottom=-5 210 210 File0.Width=1243 211 File0.Height= 443211 File0.Height=500 212 212 File0.Column=18 213 213 File0.Line=348 … … 216 216 File1.Bottom=-5 217 217 File1.Width=1243 218 File1.Height= 443218 File1.Height=500 219 219 File1.Column=1 220 220 File1.Line=33 … … 223 223 File2.Bottom=-5 224 224 File2.Width=1243 225 File2.Height= 443225 File2.Height=500 226 226 File2.Column=46 227 227 File2.Line=4190 -
trunk/NewView/unittests/cmdlineparameterunittests.pas
r27 r29 20 20 PROCEDURE testSplitCmdLineParameter_TwoQuotedParts; 21 21 PROCEDURE testSplitCmdLineParameter_TwoQuotesAtStartEnd; 22 PROCEDURE testSplitCmdLineParameter_Failure_TwoQuotesAtEnd; 22 23 PROCEDURE testSplitCmdLineParameter_TwoQuotedPartsMissingClosedQuote; 24 PROCEDURE testSplitCmdLineParameter_1Quote; 25 PROCEDURE testSplitCmdLineParameter_2Quote; 26 PROCEDURE testSplitCmdLineParameter_3Quote; 27 PROCEDURE testSplitCmdLineParameter_4Quote; 28 PROCEDURE testSplitCmdLineParameter_5Quote; 29 PROCEDURE testSplitCmdLineParameter_6Quote; 23 30 24 31 PROCEDURE testParseCmdLine_Empty; … … 235 242 236 243 244 PROCEDURE testSplitCmdLineParameter_Failure_TwoQuotesAtEnd; 245 VAR 246 tmpResult : TStringList; 247 tmpRC : Integer; 248 BEGIN 249 tmpResult := TStringList.Create; 250 tmpRC := splitCmdLineParameter('"abc def""', tmpResult); 251 252 assertEqualsInt('testSplitCmdLineParameter_Failure_TwoQuotesAtEnd', -1, tmpRC); 253 assertEqualsInt('testSplitCmdLineParameter_Failure_TwoQuotesAtEnd', 1, tmpResult.Count); 254 assertEqualsString('testSplitCmdLineParameter_Failure_TwoQuotesAtEnd', 'abc def"', tmpResult[0]); 255 256 tmpResult.Destroy; 257 END; 258 259 237 260 PROCEDURE testSplitCmdLineParameter_TwoQuotedPartsMissingClosedQuote; 238 261 VAR … … 247 270 assertEqualsString('testSplitCmdLineParameter_TwoQuotedPartsMissingClosedQuote', 'ababc"def', tmpResult[0]); 248 271 assertEqualsString('testSplitCmdLineParameter_TwoQuotedPartsMissingClosedQuote', 'ghi', tmpResult[1]); 272 273 tmpResult.Destroy; 274 END; 275 276 277 PROCEDURE testSplitCmdLineParameter_1Quote; 278 VAR 279 tmpResult : TStringList; 280 tmpRC : Integer; 281 BEGIN 282 tmpResult := TStringList.Create; 283 tmpRC := splitCmdLineParameter('"', tmpResult); 284 285 assertEqualsInt('testSplitCmdLineParameter_1Quote', -1, tmpRC); 286 assertEqualsInt('testSplitCmdLineParameter_1Quote', 0, tmpResult.Count); 287 288 tmpResult.Destroy; 289 END; 290 291 292 PROCEDURE testSplitCmdLineParameter_2Quote; 293 VAR 294 tmpResult : TStringList; 295 tmpRC : Integer; 296 BEGIN 297 tmpResult := TStringList.Create; 298 tmpRC := splitCmdLineParameter('""', tmpResult); 299 300 assertEqualsInt('testSplitCmdLineParameter_2Quote', 0, tmpRC); 301 assertEqualsInt('testSplitCmdLineParameter_2Quote', 0, tmpResult.Count); 302 303 tmpResult.Destroy; 304 END; 305 306 307 PROCEDURE testSplitCmdLineParameter_3Quote; 308 VAR 309 tmpResult : TStringList; 310 tmpRC : Integer; 311 BEGIN 312 tmpResult := TStringList.Create; 313 tmpRC := splitCmdLineParameter('"""', tmpResult); 314 315 assertEqualsInt('testSplitCmdLineParameter_3Quote', -1, tmpRC); 316 assertEqualsInt('', 1, tmpResult.Count); 317 assertEqualsString('testSplitCmdLineParameter_3Quote', '"', tmpResult[0]); 318 319 tmpResult.Destroy; 320 END; 321 322 323 PROCEDURE testSplitCmdLineParameter_4Quote; 324 VAR 325 tmpResult : TStringList; 326 tmpRC : Integer; 327 BEGIN 328 tmpResult := TStringList.Create; 329 tmpRC := splitCmdLineParameter('""""', tmpResult); 330 331 assertEqualsInt('testSplitCmdLineParameter_4Quote', 0, tmpRC); 332 assertEqualsInt('testSplitCmdLineParameter_4Quote', 1, tmpResult.Count); 333 assertEqualsString('testSplitCmdLineParameter_4Quote', '"', tmpResult[0]); 334 335 tmpResult.Destroy; 336 END; 337 338 339 PROCEDURE testSplitCmdLineParameter_5Quote; 340 VAR 341 tmpResult : TStringList; 342 tmpRC : Integer; 343 BEGIN 344 tmpResult := TStringList.Create; 345 tmpRC := splitCmdLineParameter('"""""', tmpResult); 346 347 assertEqualsInt('testSplitCmdLineParameter_5Quote', -1, tmpRC); 348 assertEqualsInt('testSplitCmdLineParameter_5Quote', 1, tmpResult.Count); 349 assertEqualsString('testSplitCmdLineParameter_5Quote', '""', tmpResult[0]); 350 351 tmpResult.Destroy; 352 END; 353 354 355 PROCEDURE testSplitCmdLineParameter_6Quote; 356 VAR 357 tmpResult : TStringList; 358 tmpRC : Integer; 359 BEGIN 360 tmpResult := TStringList.Create; 361 tmpRC := splitCmdLineParameter('""""""', tmpResult); 362 363 assertEqualsInt('testSplitCmdLineParameter_6Quote', 0, tmpRC); 364 assertEqualsInt('testSplitCmdLineParameter_6Quote', 1, tmpResult.Count); 365 assertEqualsString('testSplitCmdLineParameter_6Quote', '""', tmpResult[0]); 249 366 250 367 tmpResult.Destroy; … … 870 987 BEGIN 871 988 result := TList.Create; 989 872 990 result.add(@testSplitCmdLineParameter_Empty); 873 991 result.add(@testSplitCmdLineParameter_simpleOne); … … 881 999 result.add(@testSplitCmdLineParameter_TwoQuotedParts); 882 1000 result.add(@testSplitCmdLineParameter_TwoQuotesAtStartEnd); 1001 result.add(@testSplitCmdLineParameter_Failure_TwoQuotesAtEnd); 883 1002 result.add(@testSplitCmdLineParameter_TwoQuotedPartsMissingClosedQuote); 1003 result.add(@testSplitCmdLineParameter_1Quote); 1004 result.add(@testSplitCmdLineParameter_2Quote); 1005 result.add(@testSplitCmdLineParameter_3Quote); 1006 result.add(@testSplitCmdLineParameter_4Quote); 1007 result.add(@testSplitCmdLineParameter_5Quote); 1008 result.add(@testSplitCmdLineParameter_6Quote); 884 1009 885 1010 result.add(@testParseCmdLine_Empty); -
trunk/NewView/unittests/newviewtests.spr
r27 r29 56 56 [Directories] 57 57 58 LastDir=P:\NEWVIEW_DEV\ BUILD\SIBYL\LIB58 LastDir=P:\NEWVIEW_DEV\NEWVIEW 59 59 OutDir=P:\NEWVIEW_DEV\build 60 60 LibDir=P:\NEWVIEW_DEV\build\library;P:\NEWVIEW_DEV\build\sibyl\lib 61 LibSrcDir= D:\PROGS\SIBYL\Source\RTL;D:\PROGS\SIBYL\Source\SPCC61 LibSrcDir=P:\NEWVIEW_DEV\NEWVIEW;D:\PROGS\SIBYL\Source\RTL;D:\PROGS\SIBYL\Source\SPCC 62 62 IncSrcDir= 63 63 CompInstallDir=D:\PROGS\SIBYL\Compnt … … 65 65 [Find History] 66 66 67 Find0= testParseCmdLine_HelpManagerText68 Find1= tmpCmdLineParameters69 Find2=testParseCmdLine_ doubleColonG70 Find3=t estParseCmdLine_empty71 Find4=testParseCmdLine_ upperHELP72 Find5=testParseCmdLine_ h73 Find6=test SplitCmdLineParameter_simpleOne74 Find7= Assert75 Find8=testSplitCmdLineParameter_ Empty76 Find9= FUNCTION77 Find10= Exception78 Find11= VAR79 Find12= Pointer80 Find13= xxx81 Find14= split82 Find15= assertTrue67 Find0=missing 68 Find1=2 69 Find2=testParseCmdLine_HelpManagerText 70 Find3=tmpCmdLineParameters 71 Find4=testParseCmdLine_doubleColonG 72 Find5=testParseCmdLine_empty 73 Find6=testParseCmdLine_upperHELP 74 Find7=testParseCmdLine_h 75 Find8=testSplitCmdLineParameter_simpleOne 76 Find9=Assert 77 Find10=testSplitCmdLineParameter_Empty 78 Find11=FUNCTION 79 Find12=Exception 80 Find13=VAR 81 Find14=Pointer 82 Find15=xxx 83 83 84 84 [General] … … 107 107 File1.Bottom=-5 108 108 File1.Width=1243 109 File1.Height=50 0110 File1.Column= 3111 File1.Line= 869109 File1.Height=501 110 File1.Column=5 111 File1.Line=1010 112 112 File2=.\testassert.pas 113 113 File2.Left=-4 … … 116 116 File2.Height=500 117 117 File2.Column=32 118 File2.Line=61 118 File2.Line=27 119 File3=..\.\CmdLineParameterUnit.pas 120 File3.Left=-4 121 File3.Bottom=-5 122 File3.Width=1243 123 File3.Height=501 124 File3.Column=68 125 File3.Line=422 119 126 120 127 [Linker Options] … … 158 165 MainFile0.Dependency14=D:\PROGS\SIBYL\Source\RTL\PMGPI.PAS 159 166 MainFile0.Dependency15=D:\PROGS\SIBYL\Source\RTL\PMDEV.PAS 160 MainFile0.Dependency16=.\TESTASSERT.PAS 161 MainFile0.Dependency17=.\CMDLINEPARAMETERUNITTESTS.PAS 167 MainFile0.Dependency16=..\.\CMDLINEPARAMETERUNIT.PAS 168 MainFile0.Dependency17=.\TESTASSERT.PAS 169 MainFile0.Dependency18=.\CMDLINEPARAMETERUNITTESTS.PAS 162 170 163 171 [Replace History]
Note:
See TracChangeset
for help on using the changeset viewer.