- changed status to resolved
TTestInsightRestClient.Create(baseUrl: string); - empty string results in range check error
Context: https://bitbucket.org/sglienke/testinsight/wiki/FAQ
I was trying the above which includes a call to TestInsightDUnit’s RunRegisteredTests() procedure. The current release of TestInsight.DUnit.pas’s RunRegisteredTests procedure however demands a baseUrl parameter.
I therefore provided an empty string as value. This seems to work fine, except when range checking is enabled.
If range checking is enabled then the following line in TTestInsightRestClient.Create() causes the range check violation:
The only problem seems to be that the expression baseUrl[Length(baseUrl)] assumes that baseUrl is not empty.
The suggested fix is to explicitly add a condition to check whether the string is empty and if so then also perform the append.
Comments (3)
-
reporter -
reporter - changed status to invalid
My mistake.
-
repo owner Well, it can theoretically happen if you pass an empty string and the inifile does not exist or does not contain the baseurl value - but then something else is terribly wrong and the TI client would not have any way to communicate with the IDE anyway.
However at least the tests would continue to run (without any reporting to the IDE though) - so I am going to fix this regardless.
- Log in to comment
Never mind. I realised what's going on and it's nothing to do with what I thought it was. Sorry!