Skip to content

Commit bf98cfe

Browse files
committed
fix: defensive coding in ListToBit
1 parent f58ef2e commit bf98cfe

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.4] - Unreleased
9+
10+
### Fixed
11+
- #54: Defend against possible configuration-dependent possible SQL exceptions in mapping INT to MAC/CLS coverage
12+
813
## [4.0.3] - 2024-08-19
914

1015
### Fixed

cls/TestCoverage/Procedures.cls

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ ClassMethod ListToBit(pSource As %List) As %Binary [ SqlName = LIST_TO_BIT, SqlP
8282
Set tResult = ""
8383
Set tPointer = 0
8484
While $ListNext(pSource,tPointer,tBitPosition) {
85-
Set $Bit(tResult,tBitPosition) = 1
85+
If $Data(tBitPosition)#2 && (tBitPosition '= "") {
86+
Set $Bit(tResult,tBitPosition) = 1
87+
}
8688
}
8789
Quit tResult
8890
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Class UnitTest.TestCoverage.Unit.Procedures Extends %UnitTest.TestCase
2+
{
3+
4+
Method TestListToBit()
5+
{
6+
Set compare = ""
7+
For i=1:1:3 {
8+
Set $Bit(compare,i) = 1
9+
}
10+
Do $$$AssertEquals(##class(TestCoverage.Procedures).ListToBit($lb(1,2,3,,"")),compare)
11+
}
12+
13+
}

module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Export generator="Cache" version="25">
33
<Document name="TestCoverage.ZPM"><Module>
44
<Name>TestCoverage</Name>
5-
<Version>4.0.3</Version>
5+
<Version>4.0.4</Version>
66
<Description>Run your typical ObjectScript %UnitTest tests and see which lines of your code are executed. Includes Cobertura-style reporting for use in continuous integration tools.</Description>
77
<Packaging>module</Packaging>
88
<Resource Name="TestCoverage.PKG" Directory="cls" />

0 commit comments

Comments
 (0)