taddstr1.pp 266 B

123456789101112131415161718
  1. { tests if '' is optimized properly in string concatenations }
  2. var
  3. s1 : string;
  4. s2 : string;
  5. begin
  6. s1:='asdf';
  7. if s1+''<>s1 then
  8. halt(1);
  9. s1:='asdf';
  10. if ''+s1<>s1 then
  11. halt(1);
  12. if ''+s2+''+s1+''<>s2+s1 then
  13. halt(1);
  14. writeln('ok');
  15. end.