standard: Add tests for `Text.search_last`.
authorJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Tue, 4 Nov 2014 17:09:15 +0000 (12:09 -0500)
committerJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Tue, 4 Nov 2014 17:12:48 +0000 (12:12 -0500)
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

lib/standard/string_search.nit

index c718c96..091b3b2 100644 (file)
@@ -337,6 +337,13 @@ redef class Text
        # Search the last occurence of the text `t`.
        #
        #     assert "bob".search_last("b").from == 2
+       #     assert "bob".search_last("bo").from == 0
+       #     assert "bob".search_last("ob").from == 1
+       #     assert "bobob".search_last("ob").from == 3
+       #     assert "bobbob".search_last("bb").from == 2
+       #     assert "bobbob".search_last("bob").from == 3
+       #     assert "bob".search_last("z") == null
+       #     assert "".search_last("b") == null
        fun search_last(t: Text): nullable Match do
                return search_last_up_to(t, length)
        end