File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ fn constants() {
2626}
2727
2828#[ test]
29- fn sample_test ( ) {
29+ fn mutable_test ( ) {
3030 assert_eq ! ( format!( "{}" , 0xf ) , "15" ) ;
3131
3232 let mut variable = 1 ; // mutable means variable
@@ -57,15 +57,17 @@ fn types_test() {
5757
5858 let my_str;
5959 my_str = "1" ; // like char* in C
60+ assert_eq ! ( my_str, "1" ) ;
6061
61- #[ allow( unused_assignments) ]
6262 let mut my_string = String :: from ( my_str) ;
6363
6464 my_string = my_str. into ( ) ;
65- assert_eq ! ( my_string, "1" ) ;
65+ my_string += "2" ;
66+ assert_eq ! ( my_string, "12" ) ;
6667
67- let s2 = my_string. clone ( ) ;
68- assert_eq ! ( s2, "1" ) ;
68+ let s2 = my_string;
69+ assert_eq ! ( s2, "12" ) ;
70+ assert_eq ! ( my_string, "12" ) ;
6971
7072 my_string = "aaa" . to_string ( ) ;
7173 assert ! ( !my_string. is_empty( ) ) ;
You can’t perform that action at this time.
0 commit comments