diff --git a/test.py b/test.py index 58de4f19a3b6e18d3ba7a7e08a8a0af7a5f72dfd..245c5bb0687cb4d4231d9870b7aa157b9e652da8 100644 --- a/test.py +++ b/test.py @@ -724,6 +724,35 @@ class MatchTestCase(MkexpSimpleTestCase): as Ada """) +class SplitTestCase(MkexpSimpleTestCase): + + def test_basic(self): + self.run_test(""" + %{'Douglas Noel Adams'|split(' ')} + %{'Douglas Noel Adams'|split(' ')} + """,""" + ['Douglas', 'Noel', '', 'Adams'] + ['Douglas Noel', 'Adams'] + """) + + def test_max_split(self): + self.run_test(""" + %{'Douglas Noel Adams'|split(' ', 2)} + %{'Douglas Noel Adams'|split(' ', 1)} + """,""" + ['Douglas', 'Noel', ' Adams'] + ['Douglas', 'Noel Adams'] + """) + +class FilterTestCase(MkexpSimpleTestCase): + + def test_basic(self): + self.run_test(""" + %{['Douglas', 'Noel', '', 'Adams']|filter} + """,""" + ['Douglas', 'Noel', 'Adams'] + """) + class WordwrapTestCase(MkexpSimpleTestCase): def test_basic(self):