Commit b741fbd 1 parent 980bf38 commit b741fbd Copy full SHA for b741fbd
File tree 1 file changed +27
-1
lines changed
1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,34 @@ pub fn strict_hash_verification(enabled: bool) {
96
96
97
97
#[ cfg( test) ]
98
98
mod test {
99
+ use super :: * ;
100
+ use std:: env:: join_paths;
101
+
99
102
#[ test]
100
103
fn smoke ( ) {
101
- super :: strict_hash_verification ( false ) ;
104
+ strict_hash_verification ( false ) ;
105
+ }
106
+
107
+ #[ test]
108
+ fn search_path ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
109
+ let path = "fake_path" ;
110
+ let original = get_search_path ( ConfigLevel :: Global ) ;
111
+ assert_ne ! ( original, Ok ( path. into( ) ) ) ;
112
+
113
+ // Set
114
+ set_search_path ( ConfigLevel :: Global , & path) ?;
115
+ assert_eq ! ( get_search_path( ConfigLevel :: Global ) , Ok ( path. into( ) ) ) ;
116
+
117
+ // Append
118
+ let paths = join_paths ( [ "$PATH" , path] . iter ( ) ) ?;
119
+ let expected_paths = join_paths ( [ path, path] . iter ( ) ) ?. into_string ( ) . unwrap ( ) ;
120
+ set_search_path ( ConfigLevel :: Global , paths) ?;
121
+ assert_eq ! ( get_search_path( ConfigLevel :: Global ) , Ok ( expected_paths) ) ;
122
+
123
+ // Reset
124
+ reset_search_path ( ConfigLevel :: Global ) ?;
125
+ assert_eq ! ( get_search_path( ConfigLevel :: Global ) , original) ;
126
+
127
+ Ok ( ( ) )
102
128
}
103
129
}
You can’t perform that action at this time.
0 commit comments