| Summary: | Various string functions don't throw NullValueException | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Kathy Carroll <carrollk> | ||||||
| Component: | EDT | Assignee: | Huang Ji Yong <hjiyong> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P1 | CC: | greer, hjiyong, svihovec | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
function runPatternUtilFunction34(){@Test}
try
nS1 = null;
s2 = "abc";
s3 = "wxyz";
actualStr = nS1.replaceStr(s2,s3);
expectedStr = "wxyzdefwxyzdefwxyzdefab";
LogResult.failed("no exception");
onException (ex NullValueException)
LogResult.passed("OK");
end
end
function runIsLikeFunction10(){@Test}
try
s1 string = "ab*def";
nPattern string? = null;
actual boolean = s1.isLike(nPattern);
expected boolean = false;
LogResult.failed("Expecting an exception");
onException (ex NullValueException)
LogResult.passed("OK");
end
end
Fixed. Verified 201110172101 & closed. Related variations failed. Use eunit framework to run the attached file. Has a combination of missing desired NullValueException and getting undesired NullValueException Created attachment 205427 [details]
EGL Library Source File
more related variations
function runMatchesPatternFunction09(){@Test}
try
nS1 string? = null;
pattern string = "ab\\*[abcd][abcde][^a-e]";
actual string = nS1.matchesPattern(pattern);
LogResult.failed("Expecting exception");
onException(oops AnyException)
if (oops isa NullValueException)
LogResult.passed("OK");
else
LogResult.failed("Wrong exception");
end
end
end
function runMatchesPatternFunction10(){@Test}
try
s1 string = "ab*def";
nPattern string? = null;
actual string = s1.matchesPattern(nPattern);
expected boolean = false;
LogResult.failed("Expecting exception");
onException(oops AnyException)
if (oops isa NullValueException)
LogResult.passed("OK");
else
LogResult.failed("Wrong exception");
end
end
end
There are a couple of things going on with these most recent two variants: first, there's a missing null check which is very easy to add, however, once I do that, this exposes an issue I need to discuss with Jeff (essentially, I'm not sure that the temporary variables being used need to reflect the nullability of the variable with which they are associated). Created attachment 207009 [details]
Fix for the remaining problem
Change runtime/gen of EDecimal, EInt64, EString verified 20111115_2101 and closed |
Use EUNIT framework to run these variations library tester s1 string; nS1 string?; actualInt int; expectedInt int; actualStr string; expectedStr string; function runCharacterUtilFunction10(){@Test} try nS1 = null; actualInt = nS1.clip(); LogResult.failed("clip of null string"); onException (oops NullValueException) LogResult.passed("OK"); end end function runCharacterUtilFunction11(){@Test} try nS1 = null; actualInt = nS1.clipLeading(); LogResult.failed("clipLeading of null string"); onException (oops NullValueException) LogResult.passed("OK"); end end function runCharacterUtilFunction12(){@Test} try nS1 = null; actualInt = nS1.clip(); LogResult.failed("trim of null string"); onException (oops NullValueException) LogResult.passed("OK"); end end function runCharacterUtilFunction17(){@Test} try nS1 = null; actualInt = nS1.toUppercase(); LogResult.failed("toUppercase of null string"); onException (oops NullValueException) LogResult.passed("OK"); end end function runCharacterUtilFunction18(){@Test} try nS1 = null; actualInt = nS1.toLowercase(); LogResult.failed("toLowercase of null string"); onException (oops NullValueException) LogResult.passed("OK"); end end end