Skip to content

Commit d85763e

Browse files
committed
Maintain _testCases in pre-6.3, allow opting-in via env var in >= 6.3
1 parent 4f9d777 commit d85763e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Sources/Testing/ABI/Encoded/ABI.EncodedTest.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,25 @@ extension ABI {
9090
sourceLocation = test.sourceLocation
9191
id = ID(encoding: test.id)
9292

93+
// Experimental test case encoding: This field was included in v0 with an
94+
// underscore-prefixed name despite not having been formally proposed, and
95+
// a prominent client (the VS Code Swift plugin) depends on it. To avoid
96+
// breaking existing versions of that plugin, continue unconditionally
97+
// including this field in versions earlier than 6.3 (including v0). In
98+
// 6.3 and later, don't include it by default but allow opting-in to it
99+
// via an environment variable. (This is to maintain compatibility until
100+
// the field has been formally proposed and accepted, and discourage new
101+
// clients from becoming dependent on it in the mean time.) Finally,
102+
// in the special experimental version always include this field.
103+
if isParameterized == true,
104+
(V.versionNumber < ABI.v6_3.versionNumber
105+
|| V.versionNumber >= ABI.ExperimentalVersion.versionNumber
106+
|| Environment.flag(named: "SWT_ENABLE_EXPERIMENTAL_EVENT_STREAM_TEST_CASE_ENCODING") == true) {
107+
_testCases = test.uncheckedTestCases?.map(EncodedTestCase.init(encoding:))
108+
}
109+
93110
// Experimental
94111
if V.versionNumber >= ABI.ExperimentalVersion.versionNumber {
95-
if isParameterized == true {
96-
_testCases = test.uncheckedTestCases?.map(EncodedTestCase.init(encoding:))
97-
}
98-
99112
let tags = test.tags
100113
if !tags.isEmpty {
101114
_tags = tags.map(String.init(describing:))

0 commit comments

Comments
 (0)