Skip to content

Commit 08e9902

Browse files
committed
fix: testcoveragelist doesn't fail if FindCoverageList doesn't find samplecovlist.list in the first directory now
1 parent 1e0f4e4 commit 08e9902

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/testing/unit_tests/UnitTest/TestCoverage/Unit/TestCoverageList.cls

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Class UnitTest.TestCoverage.Unit.TestCoverageList Extends %UnitTest.TestCase
44
/// helper function to find the samplecovlist.list's path
55
ClassMethod FindCoverageList(directory As %String = "") As %String
66
{
7+
78
set stmt = ##class(%SQL.Statement).%New()
89
set status = stmt.%PrepareClassQuery("%File", "FileSet")
910
if $$$ISERR(status) {write "%Prepare failed:" do $SYSTEM.Status.DisplayError(status) quit}
@@ -22,15 +23,20 @@ ClassMethod FindCoverageList(directory As %String = "") As %String
2223
return name
2324
}
2425
} elseif (type = "D"){
25-
do ..FindCoverageList(name)
26+
set retVal = ..FindCoverageList(name)
27+
if (retVal '= "") {
28+
return retVal
29+
}
2630
}
2731
}
2832
if (rset.%SQLCODE < 0) {write "%Next failed:", !, "SQLCODE ", rset.%SQLCODE, ": ", rset.%Message quit}
33+
return "" // didn't find it in this directory
2934
}
3035

3136
Method TestGettingCoverageList()
3237
{
3338
set tFile = ..FindCoverageList(^UnitTestRoot) // finds the samplecovlist.list
39+
set ^IRIS.TEMPCJG($i(^IRIS.TEMPCJG)) = tFile
3440
do ##class(TestCoverage.Manager).GetCoverageTargetsForFile(tFile, .tTargetArray)
3541

3642
Set CorrectCoverageTargets("CLS", "TestCoverage.Data.CodeSubUnit") = ""

0 commit comments

Comments
 (0)