diff options
| -rw-r--r-- | incdec.pm | 4 | ||||
| -rw-r--r-- | t/100-increment-decrement.t | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -25,10 +25,10 @@ sub incdec { } if ($point_position >= $+[0]) { - $line_start .= substr($line_part, $previous_point_position, $+[0]); + $line_start .= substr($line_part, 0, $+[0]); $line_part = substr($line_part, $+[0]); $previous_point_position = $point_position; - $point_position = 0; + $point_position -= $+[0]; next; } diff --git a/t/100-increment-decrement.t b/t/100-increment-decrement.t index e7feccb..ee7aee9 100644 --- a/t/100-increment-decrement.t +++ b/t/100-increment-decrement.t @@ -49,4 +49,10 @@ is( 'increments the third triple-digit integer with point at position 12' ); +is( + incdec::incdec('test 12 19 555 64', 16), + 'test 12 19 555 65', + 'increments the fourth double-digit integer with point at position 16' +); + done_testing; |
