Skip to content

Commit 07db16f

Browse files
authored
Merge pull request #22 from KyleKincer/fix/subtest-assertion-propagation
Remove unreliable line numbers from assertion records
2 parents a61475a + 725122e commit 07db16f

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

testing/Project/Sources/Classes/Assert.4dm

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,43 +105,31 @@ Function contains($t : Object; $container : Variant; $value : Variant; $message
105105
End if
106106

107107
Function _recordAssertion($t : Object; $passed : Boolean; $expected : Variant; $actual : Variant; $message : Text; $callChain : Collection)
108-
var $cc : Collection
109-
var $line : Variant
110-
111-
// Use provided call chain if available, otherwise capture it
112-
If (Count parameters>=6) && ($callChain#Null)
113-
$cc:=$callChain
114-
Else
115-
$cc:=Get call chain:C1662
116-
End if
117-
118-
$line:=Null:C1517
119-
If ($cc.length>2) && ($cc[2].line#Null:C1517)
120-
$line:=$cc[2].line
121-
End if
108+
// Note: Line numbers from 4D's call chain are not reliable for showing source line locations
109+
// They reference internal function offsets rather than actual source lines
110+
// Therefore, we omit line numbers from assertion records
111+
122112
var $assertInfo : Object
123113
$assertInfo:=New object:C1471(\
124114
"passed"; $passed; \
125115
"expected"; This:C1470._sanitizeValue($expected); \
126116
"actual"; This:C1470._sanitizeValue($actual); \
127-
"message"; $message; \
128-
"line"; $line\
117+
"message"; $message\
129118
)
130119
$t.assertions.push($assertInfo)
131-
120+
132121
Function _sanitizeValue($value : Variant) : Variant
133122
var $type : Integer
134123
$type:=Value type:C1509($value)
135-
124+
136125
// Use placeholders for complex structures to avoid serialization errors
137-
Case of
126+
Case of
138127
: ($type=Is object:K8:27)
139128
return "<object>"
140129
: ($type=Is collection:K8:32)
141130
return "<collection>"
142-
Else
131+
Else
143132
return $value
144-
End case
145-
146-
147-
133+
End case
134+
135+

testing/Resources/en.lproj/syntaxEN.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,17 @@
903903
],
904904
"Summary": ""
905905
},
906+
"test_run_propagates_assertions()": {
907+
"Syntax": "**.test_run_propagates_assertions**( *t* : cs.Testing.Testing )",
908+
"Params": [
909+
[
910+
"t",
911+
"cs.Testing.Testing",
912+
"->"
913+
]
914+
],
915+
"Summary": ""
916+
},
906917
"test_fatal_method()": {
907918
"Syntax": "**.test_fatal_method**( *t* : cs.Testing.Testing )",
908919
"Params": [

0 commit comments

Comments
 (0)