@@ -5,25 +5,25 @@ use uefi::proto::shell::Shell;
55use uefi:: { boot, cstr16} ;
66use uefi_raw:: Status ;
77
8- /// Test `get_env ()`, `get_envs ()`, and `set_env ()`
8+ /// Test `var ()`, `vars ()`, and `set_var ()`
99pub fn test_env ( shell : & ScopedProtocol < Shell > ) {
1010 /* Test retrieving list of environment variable names */
11- let mut cur_env_vec = shell. get_envs ( ) ;
11+ let mut cur_env_vec = shell. vars ( ) ;
1212 assert_eq ! ( cur_env_vec. next( ) . unwrap( ) , cstr16!( "path" ) , ) ;
1313 // check pre-defined shell variables; see UEFI Shell spec
1414 assert_eq ! ( cur_env_vec. next( ) . unwrap( ) , cstr16!( "nonesting" ) , ) ;
15- let cur_env_vec = shell. get_envs ( ) ;
15+ let cur_env_vec = shell. vars ( ) ;
1616 let default_len = cur_env_vec. count ( ) ;
1717
1818 /* Test setting and getting a specific environment variable */
19- let cur_env_vec = shell. get_envs ( ) ;
19+ let cur_env_vec = shell. vars ( ) ;
2020 let test_var = cstr16 ! ( "test_var" ) ;
2121 let test_val = cstr16 ! ( "test_val" ) ;
22- assert ! ( shell. get_env ( test_var) . is_none( ) ) ;
23- let status = shell. set_env ( test_var, test_val, false ) ;
22+ assert ! ( shell. var ( test_var) . is_none( ) ) ;
23+ let status = shell. set_var ( test_var, test_val, false ) ;
2424 assert_eq ! ( status, Status :: SUCCESS ) ;
2525 let cur_env_str = shell
26- . get_env ( test_var)
26+ . var ( test_var)
2727 . expect ( "Could not get environment variable" ) ;
2828 assert_eq ! ( cur_env_str, test_val) ;
2929
@@ -34,7 +34,7 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
3434 }
3535 }
3636 assert ! ( !found_var) ;
37- let cur_env_vec = shell. get_envs ( ) ;
37+ let cur_env_vec = shell. vars ( ) ;
3838 let mut found_var = false ;
3939 for env_var in cur_env_vec {
4040 if env_var == test_var {
@@ -43,49 +43,49 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
4343 }
4444 assert ! ( found_var) ;
4545
46- let cur_env_vec = shell. get_envs ( ) ;
46+ let cur_env_vec = shell. vars ( ) ;
4747 assert_eq ! ( cur_env_vec. count( ) , default_len + 1 ) ;
4848
4949 /* Test deleting environment variable */
5050 let test_val = cstr16 ! ( "" ) ;
51- let status = shell. set_env ( test_var, test_val, false ) ;
51+ let status = shell. set_var ( test_var, test_val, false ) ;
5252 assert_eq ! ( status, Status :: SUCCESS ) ;
53- assert ! ( shell. get_env ( test_var) . is_none( ) ) ;
53+ assert ! ( shell. var ( test_var) . is_none( ) ) ;
5454
55- let cur_env_vec = shell. get_envs ( ) ;
55+ let cur_env_vec = shell. vars ( ) ;
5656 let mut found_var = false ;
5757 for env_var in cur_env_vec {
5858 if env_var == test_var {
5959 found_var = true ;
6060 }
6161 }
6262 assert ! ( !found_var) ;
63- let cur_env_vec = shell. get_envs ( ) ;
63+ let cur_env_vec = shell. vars ( ) ;
6464 assert_eq ! ( cur_env_vec. count( ) , default_len) ;
6565}
6666
67- /// Test `get_cur_dir ()` and `set_cur_dir ()`
67+ /// Test `current_dir ()` and `set_current_dir ()`
6868pub fn test_cur_dir ( shell : & ScopedProtocol < Shell > ) {
6969 /* Test setting and getting current file system and current directory */
7070 let fs_var = cstr16 ! ( "fs0:" ) ;
7171 let dir_var = cstr16 ! ( "/" ) ;
72- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
72+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
7373 assert_eq ! ( status, Status :: SUCCESS ) ;
7474
7575 let cur_fs_str = shell
76- . get_cur_dir ( Some ( fs_var) )
76+ . current_dir ( Some ( fs_var) )
7777 . expect ( "Could not get the current file system mapping" ) ;
7878 let expected_fs_str = cstr16 ! ( "FS0:\\ " ) ;
7979 assert_eq ! ( cur_fs_str, expected_fs_str) ;
8080
8181 // Changing current file system
8282 let fs_var = cstr16 ! ( "fs1:" ) ;
8383 let dir_var = cstr16 ! ( "/" ) ;
84- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
84+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
8585 assert_eq ! ( status, Status :: SUCCESS ) ;
8686
8787 let cur_fs_str = shell
88- . get_cur_dir ( Some ( fs_var) )
88+ . current_dir ( Some ( fs_var) )
8989 . expect ( "Could not get the current file system mapping" ) ;
9090 assert_ne ! ( cur_fs_str, expected_fs_str) ;
9191 let expected_fs_str = cstr16 ! ( "FS1:\\ " ) ;
@@ -94,11 +94,11 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
9494 // Changing current file system and current directory
9595 let fs_var = cstr16 ! ( "fs0:" ) ;
9696 let dir_var = cstr16 ! ( "efi/" ) ;
97- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
97+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
9898 assert_eq ! ( status, Status :: SUCCESS ) ;
9999
100100 let cur_fs_str = shell
101- . get_cur_dir ( Some ( fs_var) )
101+ . current_dir ( Some ( fs_var) )
102102 . expect ( "Could not get the current file system mapping" ) ;
103103 assert_ne ! ( cur_fs_str, expected_fs_str) ;
104104 let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
@@ -108,50 +108,50 @@ pub fn test_cur_dir(shell: &ScopedProtocol<Shell>) {
108108
109109 // At this point, the current working file system has not been set
110110 // So we expect a NULL output
111- assert ! ( shell. get_cur_dir ( None ) . is_none( ) ) ;
111+ assert ! ( shell. current_dir ( None ) . is_none( ) ) ;
112112
113113 // Setting the current working file system and current working directory
114114 let dir_var = cstr16 ! ( "fs0:/" ) ;
115- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
115+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
116116 assert_eq ! ( status, Status :: SUCCESS ) ;
117117 let cur_fs_str = shell
118- . get_cur_dir ( Some ( fs_var) )
118+ . current_dir ( Some ( fs_var) )
119119 . expect ( "Could not get the current file system mapping" ) ;
120120 let expected_fs_str = cstr16 ! ( "FS0:" ) ;
121121 assert_eq ! ( cur_fs_str, expected_fs_str) ;
122122
123123 let cur_fs_str = shell
124- . get_cur_dir ( None )
124+ . current_dir ( None )
125125 . expect ( "Could not get the current file system mapping" ) ;
126126 assert_eq ! ( cur_fs_str, expected_fs_str) ;
127127
128128 // Changing current working directory
129129 let dir_var = cstr16 ! ( "/efi" ) ;
130- let status = shell. set_cur_dir ( None , Some ( dir_var) ) ;
130+ let status = shell. set_current_dir ( None , Some ( dir_var) ) ;
131131 assert_eq ! ( status, Status :: SUCCESS ) ;
132132 let cur_fs_str = shell
133- . get_cur_dir ( Some ( fs_var) )
133+ . current_dir ( Some ( fs_var) )
134134 . expect ( "Could not get the current file system mapping" ) ;
135135 let expected_fs_str = cstr16 ! ( "FS0:\\ efi" ) ;
136136 assert_eq ! ( cur_fs_str, expected_fs_str) ;
137137 let cur_fs_str = shell
138- . get_cur_dir ( None )
138+ . current_dir ( None )
139139 . expect ( "Could not get the current file system mapping" ) ;
140140 assert_eq ! ( cur_fs_str, expected_fs_str) ;
141141
142142 // Changing current directory in a non-current working file system
143143 let fs_var = cstr16 ! ( "fs0:" ) ;
144144 let dir_var = cstr16 ! ( "efi/tools" ) ;
145- let status = shell. set_cur_dir ( Some ( fs_var) , Some ( dir_var) ) ;
145+ let status = shell. set_current_dir ( Some ( fs_var) , Some ( dir_var) ) ;
146146 assert_eq ! ( status, Status :: SUCCESS ) ;
147147 let cur_fs_str = shell
148- . get_cur_dir ( None )
148+ . current_dir ( None )
149149 . expect ( "Could not get the current file system mapping" ) ;
150150 assert_ne ! ( cur_fs_str, expected_fs_str) ;
151151
152152 let expected_fs_str = cstr16 ! ( "FS0:\\ efi\\ tools" ) ;
153153 let cur_fs_str = shell
154- . get_cur_dir ( Some ( fs_var) )
154+ . current_dir ( Some ( fs_var) )
155155 . expect ( "Could not get the current file system mapping" ) ;
156156 assert_eq ! ( cur_fs_str, expected_fs_str) ;
157157}
0 commit comments