Changeset 25 for trunk/NewView/NewViewTests.pas
- Timestamp:
- Aug 1, 2006, 8:51:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NewView/NewViewTests.pas
r23 r25 96 96 writeln('CmdLineParameterUnit Tests ''' + nativeOS2GetCmdLineParameter + ''''); 97 97 98 tmpResult := splitCmdLineParameter('', tmpRC); 98 tmpResult := TStringList.Create; 99 tmpRC := splitCmdLineParameter('', tmpResult); 99 100 assertEqualsInt('CmdLine split empy string', 0, tmpRC); 100 101 assertEqualsInt('CmdLine split empy string', 0, tmpResult.Count); 101 102 tmpResult := splitCmdLineParameter('abc', tmpRC); 102 tmpResult.Destroy; 103 104 tmpResult := TStringList.Create; 105 tmpRC := splitCmdLineParameter('abc', tmpResult); 103 106 assertEqualsInt('CmdLine split single string', 0, tmpRC); 104 107 assertEqualsInt('CmdLine split single string', 1, tmpResult.Count); 105 108 assertEqualsString('CmdLine split single string', 'abc', tmpResult[0]); 106 107 tmpResult := splitCmdLineParameter(' abc', tmpRC); 109 tmpResult.Destroy; 110 111 tmpResult := TStringList.Create; 112 tmpRC := splitCmdLineParameter(' abc', tmpResult); 108 113 assertEqualsInt('CmdLine split single string with leading blank', 0, tmpRC); 109 114 assertEqualsInt('CmdLine split single string with leading blank', 1, tmpResult.Count); 110 115 assertEqualsString('CmdLine split single string with leading blankCmdLine split many strings', 'abc', tmpResult[0]); 111 112 tmpResult := splitCmdLineParameter('abc def ghi', tmpRC); 116 tmpResult.Destroy; 117 118 tmpResult := TStringList.Create; 119 tmpRC := splitCmdLineParameter('abc def ghi', tmpResult); 113 120 assertEqualsInt('CmdLine split empy string', 0, tmpRC); 114 121 assertEqualsInt('CmdLine split many strings', 3, tmpResult.Count); … … 116 123 assertEqualsString('CmdLine split many strings', 'def', tmpResult[1]); 117 124 assertEqualsString('CmdLine split many strings', 'ghi', tmpResult[2]); 118 119 tmpResult := splitCmdLineParameter('"abc def"', tmpRC); 125 tmpResult.Destroy; 126 127 tmpResult := TStringList.Create; 128 tmpRC := splitCmdLineParameter('"abc def"', tmpResult); 120 129 assertEqualsInt('CmdLine split quoted (1)', 0, tmpRC); 121 130 assertEqualsInt('CmdLine split quoted (1)', 1, tmpResult.Count); 122 131 assertEqualsString('CmdLine split quoted (1)', 'abc def', tmpResult[0]); 123 124 tmpResult := splitCmdLineParameter('ab"abc def"', tmpRC); 132 tmpResult.Destroy; 133 134 tmpResult := TStringList.Create; 135 tmpRC := splitCmdLineParameter('ab"abc def"', tmpResult); 125 136 assertEqualsInt('CmdLine split quoted (2)', 0, tmpRC); 126 137 assertEqualsInt('CmdLine split quoted (2)', 1, tmpResult.Count); 127 138 assertEqualsString('CmdLine split quoted (2)', 'ababc def', tmpResult[0]); 128 129 tmpResult := splitCmdLineParameter('ab"""abc def"', tmpRC); 139 tmpResult.Destroy; 140 141 tmpResult := TStringList.Create; 142 tmpRC := splitCmdLineParameter('ab"""abc def"', tmpResult); 130 143 assertEqualsInt('CmdLine split quoted (3)', 0, tmpRC); 131 144 assertEqualsInt('CmdLine split quoted (3)', 1, tmpResult.Count); 132 145 assertEqualsString('CmdLine split quoted (3)', 'ab"abc def', tmpResult[0]); 133 134 tmpResult := splitCmdLineParameter('ab"abc""def"', tmpRC); 146 tmpResult.Destroy; 147 148 tmpResult := TStringList.Create; 149 tmpRC := splitCmdLineParameter('ab"abc""def"', tmpResult); 135 150 assertEqualsInt('CmdLine split quoted (4)', 0, tmpRC); 136 151 assertEqualsInt('CmdLine split quoted (4)', 1, tmpResult.Count); 137 152 assertEqualsString('CmdLine split quoted (4)', 'ababc"def', tmpResult[0]); 138 139 tmpResult := splitCmdLineParameter('ab"abc""def" "ghi"', tmpRC); 153 tmpResult.Destroy; 154 155 tmpResult := TStringList.Create; 156 tmpRC := splitCmdLineParameter('ab"abc""def" "ghi"', tmpResult); 140 157 assertEqualsInt('CmdLine split quoted (5)', 0, tmpRC); 141 158 assertEqualsInt('CmdLine split quoted (5)', 2, tmpResult.Count); 142 159 assertEqualsString('CmdLine split quoted (5)', 'ababc"def', tmpResult[0]); 143 160 assertEqualsString('CmdLine split quoted (5)', 'ghi', tmpResult[1]); 144 145 tmpResult := splitCmdLineParameter('ab"abc""def" "ghi', tmpRC); 161 tmpResult.Destroy; 162 163 tmpResult := TStringList.Create; 164 tmpRC := splitCmdLineParameter('ab"abc""def" "ghi', tmpResult); 146 165 assertEqualsInt('CmdLine split quoted (6)', -1, tmpRC); 147 166 assertEqualsInt('CmdLine split quoted (6)', 2, tmpResult.Count); 148 167 assertEqualsString('CmdLine split quoted (6)', 'ababc"def', tmpResult[0]); 149 168 assertEqualsString('CmdLine split quoted (6)', 'ghi', tmpResult[1]); 169 tmpResult.Destroy; 150 170 151 171 // parser Tests … … 510 530 tmpCmdLineParameters := TCmdLineParameters.Create; 511 531 tmpCmdLineParameters.parseCmdLine(tmpParams); 512 assertEqualsString('parseCmdLine [getFileName](70)', 'ab c', tmpCmdLineParameters.getFileName); 513 assertEqualsString('parseCmdLine [getTopic](70)', 'topi1 topi2', tmpCmdLineParameters.getTopic); 532 assertEqualsString('parseCmdLine [getFileName](70)', 'ab c', tmpCmdLineParameters.getFileNames); 533 assertEqualsString('parseCmdLine [getTopic](70)', 'topi1 topi2', tmpCmdLineParameters.getTopics); 534 514 535 END; 515 536
Note:
See TracChangeset
for help on using the changeset viewer.