From c269cc17a2945ffb4d786ade0316d562f1afe8f2 Mon Sep 17 00:00:00 2001 From: isc-dchui Date: Thu, 13 Nov 2025 10:44:54 -0500 Subject: [PATCH 1/2] Add wildcard support for CLS in coverage list --- CHANGELOG.md | 3 +++ cls/TestCoverage/Manager.cls | 23 +++++++++++++++++-- .../UnitTest/TestCoverage/Unit/Manager.cls | 21 +++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7af7dae..55ed0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [4.0.8] - 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 diff --git a/cls/TestCoverage/Manager.cls b/cls/TestCoverage/Manager.cls index 0d4c48b..69a918b 100644 --- a/cls/TestCoverage/Manager.cls +++ b/cls/TestCoverage/Manager.cls @@ -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) = "" } @@ -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 diff --git a/internal/testing/unit_tests/UnitTest/TestCoverage/Unit/Manager.cls b/internal/testing/unit_tests/UnitTest/TestCoverage/Unit/Manager.cls index ab9f8a1..ac97e90 100644 --- a/internal/testing/unit_tests/UnitTest/TestCoverage/Unit/Manager.cls +++ b/internal/testing/unit_tests/UnitTest/TestCoverage/Unit/Manager.cls @@ -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) +} + } From 3a5de0f3699e825ff64a4654eb4f6b35f9eb1c1f Mon Sep 17 00:00:00 2001 From: isc-dchui Date: Thu, 13 Nov 2025 10:54:47 -0500 Subject: [PATCH 2/2] Change semver --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55ed0d9..80b07c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ 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