1

I need to pass a lot of string values to a test procedure, the string parameters are transferred as a commatext stringlist, code goes like below

[test]
[testcase(test1,'xxxx,yyyy,zzz, ........')]
procedure Test_transmitmany strings(S1, S2, S3,  .... Sx  String);

if my stringlist gets more than 255 char's I get the error below

[dcc64 Error] Unit_TClass.test.pas(197): E2056 String literals may have at most 255 elements

What is an elegant method to pass many strings to a test case? I'm also not happy with writing the large stringlist in the testcase definition, looks pretty ugly.

Franz
  • 1,883
  • 26
  • 47
  • This is a good moment to learn the difference between a "String" and a "[literal](https://docwiki.embarcadero.com/RADStudio/Sydney/en/Declared_Constants)", so one understands why **Strings** can size up to 2 GiB, but String **literals** can only have 1/4 KiB. – AmigoJack Dec 03 '21 at 14:21

1 Answers1

2

Break the string up into multiple lines with no more than 255 characters on any one line. Then the compiler won't complain.

[testcase(test1,'xxxx,yyyy,zzz,'
  + ' ........')]
Bruce McGee
  • 15,076
  • 6
  • 55
  • 70