@@ -40,7 +40,7 @@ fn extract_regex(re: &Regex, x: String) -> (String, String) {
4040 (
4141 x. replace (
4242 & caps[ "frames" ] ,
43- String :: from_utf8 ( vec ! [ b'* ' ; caps[ "frames" ] . len( ) ] )
43+ String :: from_utf8 ( vec ! [ b'# ' ; caps[ "frames" ] . len( ) ] )
4444 . unwrap ( )
4545 . as_str ( ) ,
4646 ) ,
@@ -62,7 +62,7 @@ fn test_regex_simple() {
6262 let re = get_regex ( ) ;
6363 let source: String = "RenderPass_Beauty_1_00000.exr" . to_string ( ) ;
6464 let expected: ( String , String ) = (
65- "RenderPass_Beauty_1_***** .exr" . to_string ( ) ,
65+ "RenderPass_Beauty_1_##### .exr" . to_string ( ) ,
6666 "00000" . to_string ( ) ,
6767 ) ;
6868 assert_eq ! ( expected, extract_regex( & re, source) )
@@ -102,7 +102,7 @@ fn test_parse_string() {
102102 let vec_toto: Vec < String > = vec ! [ "001" . to_string( ) , "002" . to_string( ) , "003" . to_string( ) ] ;
103103 let vec_foo: Vec < String > = vec ! [ "None" . to_string( ) ] ;
104104 let expected: HashMap < String , Vec < String > > = HashMap :: from ( [
105- ( "toto.*** .tiff" . to_string ( ) , vec_toto) ,
105+ ( "toto.### .tiff" . to_string ( ) , vec_toto) ,
106106 ( "foo.exr" . to_string ( ) , vec_foo) ,
107107 ] ) ;
108108 assert_eq ! ( expected, parse_result( source) ) ;
@@ -161,6 +161,22 @@ fn test_convert_vec_to_str() {
161161 assert_eq ! ( expected, convert_vec_to_str( source) ) ;
162162}
163163
164+ fn concat_line ( main_string : String , frame_string : String ) -> String {
165+ let buf: bool = false ;
166+ if buf {
167+ let from: String = String :: from ( "#####" ) ;
168+ main_string. replace ( & from, & frame_string)
169+ } else {
170+ format ! ( "{}@{}" , main_string, frame_string)
171+ }
172+ }
173+ #[ test]
174+ fn test_concat_line ( ) {
175+ let main_string: String = String :: from ( "toto" ) ;
176+ let frame_string: String = String :: from ( "bar" ) ;
177+ let expected: String = String :: from ( "toto@bar" ) ;
178+ assert_eq ! ( expected, concat_line( main_string, frame_string) ) ;
179+ }
164180pub fn basic ( frames : Vec < String > ) -> Vec < String > {
165181 let frames_dict: HashMap < String , Vec < String > > = parse_result ( frames) ;
166182 let mut out_frames: Vec < String > = Vec :: new ( ) ;
@@ -171,7 +187,7 @@ pub fn basic(frames: Vec<String>) -> Vec<String> {
171187 let i = convert_vec ( value) ;
172188 let j = group_continuity ( & i) ;
173189 let k = convert_vec_to_str ( j) ;
174- out_frames. push ( format ! ( "{}@{}" , key, k) ) ;
190+ out_frames. push ( concat_line ( key, k) ) ;
175191 }
176192 }
177193 out_frames
@@ -186,7 +202,7 @@ pub fn listing(root_path: String, frames: Vec<String>) -> Vec<String> {
186202 out_frames. push ( key) ;
187203 } else {
188204 let to = value. first ( ) . unwrap ( ) ;
189- let from = String :: from_utf8 ( vec ! [ b'* ' ; to. len( ) ] ) . unwrap ( ) ;
205+ let from = String :: from_utf8 ( vec ! [ b'# ' ; to. len( ) ] ) . unwrap ( ) ;
190206 let new_path = & key. replace ( & from, to) ;
191207 if re. is_match ( new_path) {
192208 let path = format ! ( "{}{}" , root_path, new_path) ;
@@ -195,7 +211,7 @@ pub fn listing(root_path: String, frames: Vec<String>) -> Vec<String> {
195211 let i = convert_vec ( value) ;
196212 let j = group_continuity ( & i) ;
197213 let k = convert_vec_to_str ( j) ;
198- out_frames. push ( format ! ( "{}@{}" , key, k) ) ;
214+ out_frames. push ( concat_line ( key, k) ) ;
199215 }
200216 }
201217 out_frames
0 commit comments