@@ -74,17 +74,9 @@ fn get_env_var<'a>(name: &str, env_map: &'a mut HashMap<String, String>) -> Opti
74
74
mod tests {
75
75
use super :: * ;
76
76
use std:: collections:: HashMap ;
77
- use std:: env;
78
-
79
- fn setup ( ) {
80
- // Clear relevant environment variables before each test
81
- env:: remove_var ( "TERM_PROGRAM" ) ;
82
- env:: remove_var ( "VSCODE_GIT_ASKPASS_NODE" ) ;
83
- }
84
77
85
78
#[ test]
86
79
fn test_detect_vscode ( ) {
87
- setup ( ) ;
88
80
let mut test_env = HashMap :: new ( ) ;
89
81
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "vscode" . to_string ( ) ) ;
90
82
test_env. insert (
@@ -96,7 +88,6 @@ mod tests {
96
88
97
89
#[ test]
98
90
fn test_detect_cursor ( ) {
99
- setup ( ) ;
100
91
let mut test_env = HashMap :: new ( ) ;
101
92
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "vscode" . to_string ( ) ) ;
102
93
test_env. insert (
@@ -108,7 +99,6 @@ mod tests {
108
99
109
100
#[ test]
110
101
fn test_detect_windsurf ( ) {
111
- setup ( ) ;
112
102
let mut test_env = HashMap :: new ( ) ;
113
103
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "vscode" . to_string ( ) ) ;
114
104
test_env. insert (
@@ -120,21 +110,13 @@ mod tests {
120
110
121
111
#[ test]
122
112
fn test_detect_jetbrains ( ) {
123
- setup ( ) ;
124
113
let mut test_env = HashMap :: new ( ) ;
125
114
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "jetbrains" . to_string ( ) ) ;
126
115
assert_eq ! ( detect_editor( test_env) , SupportedEditor :: JetBrains ) ;
127
116
}
128
117
129
- #[ test]
130
- fn test_term_program_missing ( ) {
131
- setup ( ) ;
132
- assert_eq ! ( detect_editor( HashMap :: new( ) ) , SupportedEditor :: Unknown ) ;
133
- }
134
-
135
118
#[ test]
136
119
fn test_term_program_unknown ( ) {
137
- setup ( ) ;
138
120
let mut test_env = HashMap :: new ( ) ;
139
121
test_env. insert (
140
122
"TERM_PROGRAM" . to_string ( ) ,
@@ -145,7 +127,6 @@ mod tests {
145
127
146
128
#[ test]
147
129
fn test_vscode_without_askpass_confirmation ( ) {
148
- setup ( ) ;
149
130
let mut test_env = HashMap :: new ( ) ;
150
131
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "vscode" . to_string ( ) ) ;
151
132
// No VSCODE_GIT_ASKPASS_NODE set or doesn't contain "vscode"
@@ -154,7 +135,6 @@ mod tests {
154
135
155
136
#[ test]
156
137
fn test_vscode_with_wrong_askpass ( ) {
157
- setup ( ) ;
158
138
let mut test_env = HashMap :: new ( ) ;
159
139
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "vscode" . to_string ( ) ) ;
160
140
test_env. insert (
@@ -166,7 +146,6 @@ mod tests {
166
146
167
147
#[ test]
168
148
fn test_case_insensitivity ( ) {
169
- setup ( ) ;
170
149
let mut test_env = HashMap :: new ( ) ;
171
150
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "VSCode" . to_string ( ) ) ;
172
151
test_env. insert (
@@ -178,7 +157,6 @@ mod tests {
178
157
179
158
#[ test]
180
159
fn test_cursor_without_askpass_confirmation ( ) {
181
- setup ( ) ;
182
160
let mut test_env = HashMap :: new ( ) ;
183
161
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "cursor" . to_string ( ) ) ;
184
162
// No VSCODE_GIT_ASKPASS_NODE set
@@ -187,7 +165,6 @@ mod tests {
187
165
188
166
#[ test]
189
167
fn test_cursor_with_wrong_askpass ( ) {
190
- setup ( ) ;
191
168
let mut test_env = HashMap :: new ( ) ;
192
169
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "cursor" . to_string ( ) ) ;
193
170
test_env. insert (
@@ -199,7 +176,6 @@ mod tests {
199
176
200
177
#[ test]
201
178
fn test_windsurf_without_askpass_confirmation ( ) {
202
- setup ( ) ;
203
179
let mut test_env = HashMap :: new ( ) ;
204
180
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "windsurf" . to_string ( ) ) ;
205
181
// No VSCODE_GIT_ASKPASS_NODE set
@@ -208,7 +184,6 @@ mod tests {
208
184
209
185
#[ test]
210
186
fn test_windsurf_with_wrong_askpass ( ) {
211
- setup ( ) ;
212
187
let mut test_env = HashMap :: new ( ) ;
213
188
test_env. insert ( "TERM_PROGRAM" . to_string ( ) , "windsurf" . to_string ( ) ) ;
214
189
test_env. insert (
0 commit comments