Commit d1937e9
authored
fix(filter): handle nil argument for replace_last (#177)
When `replace_last` is called with a `nil` value for the string to be replaced, it should append the replacement string to the input.
This was not happening, and the filter was returning the input string unchanged.
This commit fixes this by checking if the string to be replaced is empty after being converted to a string, and if so, appending the replacement.
A doctest and an integration test have been added to cover this case.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent 47b0b8a commit d1937e9
File tree
2 files changed
+12
-5
lines changed- lib/solid
- test/solid/integration/scenarios/filter
2 files changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
| 708 | + | |
| 709 | + | |
708 | 710 | | |
709 | 711 | | |
710 | 712 | | |
711 | 713 | | |
712 | | - | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | | - | |
| 717 | + | |
716 | 718 | | |
717 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
718 | 724 | | |
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
722 | 728 | | |
723 | 729 | | |
724 | 730 | | |
725 | | - | |
726 | | - | |
| 731 | + | |
| 732 | + | |
727 | 733 | | |
728 | 734 | | |
729 | 735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
463 | 464 | | |
464 | 465 | | |
465 | 466 | | |
| |||
0 commit comments