tcase27.pp 969 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {%FAIL}
  2. { duplicate labels in different cases }
  3. {$H+}
  4. var
  5. my_str: string;
  6. my_str_wide: widestring;
  7. my_str_ansi: ansistring;
  8. my_str_uni: unicodestring;
  9. i: integer;
  10. begin
  11. my_str := 'cab';
  12. my_str_wide := 'cab';
  13. my_str_ansi := 'cab';
  14. my_str_uni := 'cab';
  15. i := -1;
  16. case my_str of
  17. 'a'..'b': i := 1;
  18. 'c': i := 2;
  19. 'c': i := 3;
  20. else i := 0;
  21. end;
  22. if (i <> 3) then begin
  23. writeln('Error');
  24. Halt(1);
  25. end;
  26. case my_str_wide of
  27. 'a'..'b': i := 1;
  28. 'c': i := 2;
  29. 'c': i := 3;
  30. else i := 0;
  31. end;
  32. if (i <> 3) then begin
  33. writeln('Error');
  34. Halt(1);
  35. end;
  36. case my_str_ansi of
  37. 'a'..'b': i := 1;
  38. 'c': i := 2;
  39. 'c': i := 3;
  40. else i := 0;
  41. end;
  42. if (i <> 3) then begin
  43. writeln('Error');
  44. Halt(1);
  45. end;
  46. case my_str_uni of
  47. 'a'..'b': i := 1;
  48. 'c': i := 2;
  49. 'c': i := 3;
  50. else i := 0;
  51. end;
  52. if (i <> 3) then begin
  53. writeln('Error');
  54. Halt(1);
  55. end;
  56. end.