File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ class TestProcessInfo : XCTestCase {
38
38
// just test that the initial name is not empty or something?
39
39
#if DARWIN_COMPATIBILITY_TESTS
40
40
let targetName = " xctest "
41
+ #elseif os(Windows)
42
+ let targetName = " TestFoundation.exe "
41
43
#else
42
44
let targetName = " TestFoundation "
43
45
#endif
@@ -71,7 +73,8 @@ class TestProcessInfo : XCTestCase {
71
73
#if os(Windows)
72
74
func setenv( _ key: String , _ value: String , _ overwrite: Int ) -> Int32 {
73
75
assert ( overwrite == 1 )
74
- return putenv ( " \( key) = \( value) " )
76
+ guard !key. contains ( " = " ) else { return - 1 }
77
+ return _putenv ( " \( key) = \( value) " )
75
78
}
76
79
#endif
77
80
@@ -104,7 +107,12 @@ class TestProcessInfo : XCTestCase {
104
107
XCTAssertNil ( env [ " bad3 " ] )
105
108
XCTAssertNil ( env [ " bad3= " ] )
106
109
110
+ #if os(Windows)
111
+ // On Windows, adding an empty environment variable removes it from the environment
112
+ XCTAssertNil ( env [ " var1 " ] )
113
+ #else
107
114
XCTAssertEqual ( env [ " var1 " ] , " " )
115
+ #endif
108
116
XCTAssertEqual ( env [ " var2 " ] , " = " )
109
117
XCTAssertEqual ( env [ " var3 " ] , " =x " )
110
118
XCTAssertEqual ( env [ " var4 " ] , " x= " )
You can’t perform that action at this time.
0 commit comments