33use  uefi:: boot:: ScopedProtocol ; 
44use  uefi:: proto:: shell:: Shell ; 
55use  uefi:: { boot,  cstr16} ; 
6- use  uefi_raw:: Status ; 
76
8- /// Test `get_env ()`, `get_envs ()`, and `set_env ()` 
7+ /// Test `var ()`, `vars ()`, and `set_var ()` 
98pub  fn  test_env ( shell :  & ScopedProtocol < Shell > )  { 
109    /* Test retrieving list of environment variable names */ 
11-     let  mut  cur_env_vec = shell. get_envs ( ) ; 
10+     let  mut  cur_env_vec = shell. vars ( ) ; 
1211    assert_eq ! ( cur_env_vec. next( ) . unwrap( ) ,  cstr16!( "path" ) , ) ; 
1312    // check pre-defined shell variables; see UEFI Shell spec 
1413    assert_eq ! ( cur_env_vec. next( ) . unwrap( ) ,  cstr16!( "nonesting" ) , ) ; 
15-     let  cur_env_vec = shell. get_envs ( ) ; 
14+     let  cur_env_vec = shell. vars ( ) ; 
1615    let  default_len = cur_env_vec. count ( ) ; 
1716
1817    /* Test setting and getting a specific environment variable */ 
19-     let  cur_env_vec = shell. get_envs ( ) ; 
18+     let  cur_env_vec = shell. vars ( ) ; 
2019    let  test_var = cstr16 ! ( "test_var" ) ; 
2120    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 ) ; 
24-     assert_eq ! ( status,   Status :: SUCCESS ) ; 
21+     assert ! ( shell. var ( test_var) . is_none( ) ) ; 
22+     let  status = shell. set_var ( test_var,  test_val,  false ) ; 
23+     assert ! ( status. is_ok ( ) ) ; 
2524    let  cur_env_str = shell
26-         . get_env ( test_var) 
25+         . var ( test_var) 
2726        . expect ( "Could not get environment variable" ) ; 
2827    assert_eq ! ( cur_env_str,  test_val) ; 
2928
@@ -34,7 +33,7 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
3433        } 
3534    } 
3635    assert ! ( !found_var) ; 
37-     let  cur_env_vec = shell. get_envs ( ) ; 
36+     let  cur_env_vec = shell. vars ( ) ; 
3837    let  mut  found_var = false ; 
3938    for  env_var in  cur_env_vec { 
4039        if  env_var == test_var { 
@@ -43,24 +42,24 @@ pub fn test_env(shell: &ScopedProtocol<Shell>) {
4342    } 
4443    assert ! ( found_var) ; 
4544
46-     let  cur_env_vec = shell. get_envs ( ) ; 
45+     let  cur_env_vec = shell. vars ( ) ; 
4746    assert_eq ! ( cur_env_vec. count( ) ,  default_len + 1 ) ; 
4847
4948    /* Test deleting environment variable */ 
5049    let  test_val = cstr16 ! ( "" ) ; 
51-     let  status = shell. set_env ( test_var,  test_val,  false ) ; 
52-     assert_eq ! ( status,   Status :: SUCCESS ) ; 
53-     assert ! ( shell. get_env ( test_var) . is_none( ) ) ; 
50+     let  status = shell. set_var ( test_var,  test_val,  false ) ; 
51+     assert ! ( status. is_ok ( ) ) ; 
52+     assert ! ( shell. var ( test_var) . is_none( ) ) ; 
5453
55-     let  cur_env_vec = shell. get_envs ( ) ; 
54+     let  cur_env_vec = shell. vars ( ) ; 
5655    let  mut  found_var = false ; 
5756    for  env_var in  cur_env_vec { 
5857        if  env_var == test_var { 
5958            found_var = true ; 
6059        } 
6160    } 
6261    assert ! ( !found_var) ; 
63-     let  cur_env_vec = shell. get_envs ( ) ; 
62+     let  cur_env_vec = shell. vars ( ) ; 
6463    assert_eq ! ( cur_env_vec. count( ) ,  default_len) ; 
6564} 
6665
0 commit comments