Closed yoavnir closed 3 months ago
The problem seems to be in DataField::getSubstringPart
. Should check it more thoroughly. It looks like you can specify either ws
or fs
but not both?
It's less of an issue than I initially thought, because a substring
is always going to have a range, and that range is either a word-range, or a field-range, or just a character range. So there's never really a point in specifying both a field separator and a word separator. Still, I made it so that this is allowed.
As for the original issue, yes, unless the user specified separators for the big part, specs used the separators of the small part. That was incorrect - it should have been the default separators and this is how it is now.
Suppose my specification contains the following spec unit:
Now let's suppose the input string is this:
What I would expect is for the global word separator (by default, a space) to apply for calculating the big part. So the Big part would be the third word (as separated by spaces), so
1/1/1970
.Then to calculate the Spec Unit result, we switch the word separator to a slash (
/
) and the second word is1
, which should be the result.Instead, the internal word separator applies to the entire unit. So taking the whole string and interpreting it as words separated by slashes, the words are:
The Epoch: 1
1
1970 at midnight
So we take the third of those and try to find the second slash-separated word, and get an empty string.