File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed
Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -135,3 +135,16 @@ impl Capitalize for str {
135135 } )
136136 }
137137}
138+
139+ #[ cfg( test) ]
140+ mod test {
141+ use super :: * ;
142+
143+ #[ test]
144+ fn test_capitalize ( ) {
145+ assert_eq ! ( "Zbnmasd" , "zbnmasd" . capitalize( ) ) ; // spell-checker:disable-line
146+ assert_eq ! ( "Abnmasd" , "Abnmasd" . capitalize( ) ) ; // spell-checker:disable-line
147+ assert_eq ! ( "1masd" , "1masd" . capitalize( ) ) ; // spell-checker:disable-line
148+ assert_eq ! ( "" , "" . capitalize( ) ) ;
149+ }
150+ }
Original file line number Diff line number Diff line change 33// For the full copyright and license information, please view the LICENSE
44// file that was distributed with this source code.
55
6- use pinky:: Capitalize ;
76#[ cfg( not( target_os = "openbsd" ) ) ]
87use uucore:: entries:: { Locate , Passwd } ;
9- use uutests:: new_ucmd;
10- use uutests:: unwrap_or_return;
11- #[ cfg( target_os = "openbsd" ) ]
12- use uutests:: util:: TestScenario ;
138#[ cfg( not( target_os = "openbsd" ) ) ]
149use uutests:: util:: { TestScenario , expected_result} ;
15- use uutests:: util_name;
10+ use uutests:: { new_ucmd , unwrap_or_return , util_name} ;
1611
1712#[ test]
1813fn test_invalid_arg ( ) {
1914 new_ucmd ! ( ) . arg ( "--definitely-invalid" ) . fails_with_code ( 1 ) ;
2015}
2116
22- #[ test]
23- fn test_capitalize ( ) {
24- assert_eq ! ( "Zbnmasd" , "zbnmasd" . capitalize( ) ) ; // spell-checker:disable-line
25- assert_eq ! ( "Abnmasd" , "Abnmasd" . capitalize( ) ) ; // spell-checker:disable-line
26- assert_eq ! ( "1masd" , "1masd" . capitalize( ) ) ; // spell-checker:disable-line
27- assert_eq ! ( "" , "" . capitalize( ) ) ;
28- }
29-
3017#[ test]
3118#[ cfg( not( target_os = "openbsd" ) ) ]
3219fn test_long_format ( ) {
20+ use pinky:: Capitalize ;
21+
3322 let login = "root" ;
3423 let pw: Passwd = Passwd :: locate ( login) . unwrap ( ) ;
3524 let user_info = pw. user_info . unwrap_or_default ( ) ;
You can’t perform that action at this time.
0 commit comments