File tree 1 file changed +12
-1
lines changed
1 file changed +12
-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,11 @@ 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 {
77
+ errno = EINVAL
78
+ return - 1
79
+ }
80
+ return _putenv ( " \( key) = \( value) " )
75
81
}
76
82
#endif
77
83
@@ -104,7 +110,12 @@ class TestProcessInfo : XCTestCase {
104
110
XCTAssertNil ( env [ " bad3 " ] )
105
111
XCTAssertNil ( env [ " bad3= " ] )
106
112
113
+ #if os(Windows)
114
+ // On Windows, adding an empty environment variable removes it from the environment
115
+ XCTAssertNil ( env [ " var1 " ] )
116
+ #else
107
117
XCTAssertEqual ( env [ " var1 " ] , " " )
118
+ #endif
108
119
XCTAssertEqual ( env [ " var2 " ] , " = " )
109
120
XCTAssertEqual ( env [ " var3 " ] , " =x " )
110
121
XCTAssertEqual ( env [ " var4 " ] , " x= " )
You can’t perform that action at this time.
0 commit comments