Changeset 236 for branches/xpascal/Tests.pas
- Timestamp:
- Jun 29, 2023, 1:47:58 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Tests.pas
r235 r236 158 158 ExpectedOutput := '-1' + LineEnding + '0' + LineEnding; 159 159 end; 160 with TTestRun(Result.AddNew('function without result usage', TTestRun)) do begin 161 Source.Add('function IsZero(A: Integer): Boolean;'); 162 Source.Add('begin'); 163 Source.Add(' Result := A = 0;'); 164 Source.Add('end;'); 165 Source.Add(''); 166 Source.Add('begin'); 167 Source.Add(' IsZero(0);'); 168 Source.Add('end.'); 169 ExpectedOutput := ''; 170 end; 160 171 with TTestRun(Result.AddNew('function var parameter', TTestRun)) do begin 161 172 Source.Add('function Test(var A: Integer): Boolean;'); 162 173 Source.Add('begin'); 163 174 Source.Add(' A := 10;'); 164 Source.Add(' Result := True;');175 Source.Add(' Result := 1 = 1;'); 165 176 Source.Add('end;'); 166 177 Source.Add(''); 167 178 Source.Add('var'); 168 179 Source.Add(' B: Integer;'); 180 Source.Add(' C: Boolean;'); 169 181 Source.Add('begin'); 170 182 Source.Add(' B := 1;'); 171 Source.Add(' Test(B);');183 Source.Add(' C := Test(B);'); 172 184 Source.Add(' WriteLn(IntToStr(B));'); 173 185 Source.Add('end.'); 174 ExpectedOutput := ' -1' + LineEnding + '0' + LineEnding;186 ExpectedOutput := '10' + LineEnding; 175 187 end; 176 188 with TTestRun(Result.AddNew('procedure', TTestRun)) do begin
Note:
See TracChangeset
for help on using the changeset viewer.