Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.8] - Unreleased
## [4.1.0] - Unreleased

### Added
- #64: Wildcard support for CLS files in coverage lists

### Fixed
- #70: Performance regression on newer IRIS versions when table stats are missing on a clean instance/run
Expand Down
23 changes: 21 additions & 2 deletions cls/TestCoverage/Manager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,10 @@ ClassMethod GetCoverageTargetsForFile(pFileName As %String, Output pTargetArray)
$$$ThrowOnError(tSC)
Set tExtension = "CLS"
} ElseIf (tExtension = "CLS") {
If (tName = "*") {
// TODO: support special case of *.CLS
If (tName [ "*") {
// *.CLS is "all classes in the current namespace's default routine database"
// Will ignore system classes unless run in %SYS namespace or "%" is included in the expression
Do ..SearchClasses(tLine,.tNames)
} Else {
Set tNames(tName) = ""
}
Expand Down Expand Up @@ -506,6 +508,23 @@ ClassMethod SearchRoutines(pSearchExpr As %String, Output pRoutines) [ Private ]
} While 'tAtEnd
}

/// Returns the classes in this namespace that satisfy the pSearchExpr
/// Will not return system classes unless run in %SYS or pSearchExpr contains "%" prefix
ClassMethod SearchClasses(pSearchExpr As %String, Output pClasses)
{
set statement = "SELECT Name FROM %Library.RoutineMgr_StudioOpenDialog(?,1,1,0,1,0,0)"

#dim result As %SQL.StatementResult
Set result = ##class(%SQL.Statement).%ExecDirect(,statement, pSearchExpr)
If (result.%SQLCODE < 0) {
Throw ##class(%Exception.SQL).CreateFromSQLCODE(result.%SQLCODE,result.%Message)
}
While result.%Next(.tSC) {
$$$ThrowOnError(tSC)
set pClasses($Piece(result.%Get("Name"),".",1,*-1)) = ""
}
}

Method GetObjectCodeForSourceNames(pSourceNameList As %List) As %List [ Private ]
{
New $Namespace
Expand Down
21 changes: 21 additions & 0 deletions internal/testing/unit_tests/UnitTest/TestCoverage/Unit/Manager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,25 @@ Method TestAutoUserNames()
Do $$$AssertNotTrue(##class(Security.Users).Exists("TestD"))
}

Method TestSearchClasses()
{
set expr = "TestCoverage.DataType.*"
do ##class(TestCoverage.Manager).SearchClasses(expr, .classes)

do $$$AssertTrue($data(classes("TestCoverage.DataType.Bitstring")))
do $$$AssertTrue($data(classes("TestCoverage.DataType.Detail")))
do $$$AssertTrue($data(classes("TestCoverage.DataType.Metric")))
do $$$AssertTrue($data(classes("TestCoverage.DataType.RoutineType")))
do $$$AssertTrue($data(classes("TestCoverage.DataType.Timing")))

set count = 0
set node = ""
for {
set node = $Order(classes(node))
quit:node=""
set count = count + 1
}
do $$$AssertEquals(count, 5)
}

}
Loading