File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,14 @@ impl<'a> AsciiArt<'a> {
29
29
end,
30
30
}
31
31
}
32
+
32
33
pub fn width ( & self ) -> usize {
33
34
assert ! ( self . end >= self . start) ;
34
35
self . end - self . start
35
36
}
36
37
}
37
38
38
- pub fn get_min_start_max_end ( lines : & [ & str ] ) -> ( usize , usize ) {
39
+ fn get_min_start_max_end ( lines : & [ & str ] ) -> ( usize , usize ) {
39
40
lines
40
41
. iter ( )
41
42
. map ( |line| {
@@ -239,6 +240,18 @@ fn char_token(s: &str) -> ParseResult<Token> {
239
240
mod test {
240
241
use super :: * ;
241
242
243
+ #[ test]
244
+ fn test_get_min_start_max_end ( ) {
245
+ let lines = [
246
+ " xxx" ,
247
+ " xxx" ,
248
+ " oo" ,
249
+ " o" ,
250
+ " xx" ,
251
+ ] ;
252
+ assert_eq ! ( get_min_start_max_end( & lines) , ( 3 , 29 ) ) ;
253
+ }
254
+
242
255
#[ test]
243
256
fn space_parses ( ) {
244
257
assert_eq ! ( space_token( " " ) , Some ( ( "" , Token :: Space ) ) ) ;
You can’t perform that action at this time.
0 commit comments