Changeset 237


Ignore:
Timestamp:
Jun 29, 2023, 11:15:54 PM (10 months ago)
Author:
chronos
Message:
  • Added: More tests.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xpascal/Tests.pas

    r236 r237  
    185185    Source.Add('end.');
    186186    ExpectedOutput := '10' + LineEnding;
     187  end;
     188  with TTestRun(Result.AddNew('function var', TTestRun)) do begin
     189    Source.Add('function Test(A: string): string;');
     190    Source.Add('var');
     191    Source.Add('  C: string;');
     192    Source.Add('begin');
     193    Source.Add('  C := A;');
     194    Source.Add('  Result := C;');
     195    Source.Add('end;');
     196    Source.Add('');
     197    Source.Add('begin');
     198    Source.Add('  WriteLn(Test(''X''));');
     199    Source.Add('end.');
     200    ExpectedOutput := 'X' + LineEnding;
     201  end;
     202  with TTestRun(Result.AddNew('function const', TTestRun)) do begin
     203    Source.Add('function Test: string;');
     204    Source.Add('const');
     205    Source.Add('  D: string = ''X'';');
     206    Source.Add('begin');
     207    Source.Add('  Result := D;');
     208    Source.Add('end;');
     209    Source.Add('');
     210    Source.Add('begin');
     211    Source.Add('  WriteLn(Test);');
     212    Source.Add('end.');
     213    ExpectedOutput := 'X' + LineEnding;
    187214  end;
    188215  with TTestRun(Result.AddNew('procedure', TTestRun)) do begin
Note: See TracChangeset for help on using the changeset viewer.