Changeset 233 for branches/xpascal/Tests.pas
- Timestamp:
- Jun 26, 2023, 6:08:23 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Tests.pas
r230 r233 158 158 ExpectedOutput := '-1' + LineEnding + '0' + LineEnding; 159 159 end; 160 with TTestRun(Result.AddNew('procedure', TTestRun)) do begin 161 Source.Add('procedure Print(Text: string);'); 162 Source.Add('begin'); 163 Source.Add(' WriteLn(Text);'); 164 Source.Add('end;'); 165 Source.Add(''); 166 Source.Add('begin'); 167 Source.Add(' Print(''Test'');'); 168 Source.Add('end.'); 169 ExpectedOutput := 'Test' + LineEnding; 170 end; 171 with TTestRun(Result.AddNew('procedure var parameter', TTestRun)) do begin 172 Source.Add('procedure Test(var A: Integer);'); 173 Source.Add('begin'); 174 Source.Add(' A := 10;'); 175 Source.Add('end;'); 176 Source.Add(''); 177 Source.Add('var'); 178 Source.Add(' B: Integer;'); 179 Source.Add('begin'); 180 Source.Add(' B := 1;'); 181 Source.Add(' Test(B);'); 182 Source.Add(' WriteLn(IntToStr(B));'); 183 Source.Add('end.'); 184 ExpectedOutput := '10' + LineEnding; 185 end; 186 with TTestRun(Result.AddNew('Single line comment', TTestRun)) do begin 187 Source.Add('begin'); 188 Source.Add(' // WriteLn(''Test'');'); 189 Source.Add('end.'); 190 ExpectedOutput := ''; 191 end; 160 192 end; 161 193 … … 169 201 procedure TTestRun.InterpreterError(Pos: TPoint; Text: string); 170 202 begin 171 Error := Error + Text;203 Error := Error + '[' + IntToStr(Pos.X) + ', ' + IntToStr(Pos.Y) + '] ' + Text + LineEnding; 172 204 end; 173 205
Note:
See TracChangeset
for help on using the changeset viewer.