File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ impl Method {
123
123
_ => Method :: extension_inline ( src) ,
124
124
} ,
125
125
_ => {
126
- if src. len ( ) < InlineExtension :: MAX {
126
+ if src. len ( ) <= InlineExtension :: MAX {
127
127
Method :: extension_inline ( src)
128
128
} else {
129
129
let allocated = AllocatedExtension :: new ( src) ?;
@@ -465,6 +465,21 @@ mod test {
465
465
466
466
let long_method = "This_is_a_very_long_method.It_is_valid_but_unlikely." ;
467
467
assert_eq ! ( Method :: from_str( long_method) . unwrap( ) , long_method) ;
468
+
469
+ let longest_inline_method = [ b'A' ; InlineExtension :: MAX ] ;
470
+ assert_eq ! (
471
+ Method :: from_bytes( & longest_inline_method) . unwrap( ) ,
472
+ Method ( ExtensionInline (
473
+ InlineExtension :: new( & longest_inline_method) . unwrap( )
474
+ ) )
475
+ ) ;
476
+ let shortest_allocated_method = [ b'A' ; InlineExtension :: MAX + 1 ] ;
477
+ assert_eq ! (
478
+ Method :: from_bytes( & shortest_allocated_method) . unwrap( ) ,
479
+ Method ( ExtensionAllocated (
480
+ AllocatedExtension :: new( & shortest_allocated_method) . unwrap( )
481
+ ) )
482
+ ) ;
468
483
}
469
484
470
485
#[ test]
You can’t perform that action at this time.
0 commit comments