Search code examples
delphidunitdunitx

DUNIT X , pass large number of strings


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.


Solution

  • 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,'
      + ' ........')]