summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/tests/test_utils.py
blob: 96e4f98f2cc622b47902edc3f63091f2118ded27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from wafsamba.tests import TestCase

from wafsamba.samba_utils import TO_LIST

class ToListTests(TestCase):

    def test_none(self):
        self.assertEquals([], TO_LIST(None))

    def test_already_list(self):
        self.assertEquals(["foo", "bar", 1], TO_LIST(["foo", "bar", 1]))

    def test_default_delimiter(self):
        self.assertEquals(["foo", "bar"], TO_LIST("foo bar"))
        self.assertEquals(["foo", "bar"], TO_LIST("  foo bar  "))
        self.assertEquals(["foo ", "bar"], TO_LIST("  \"foo \" bar  "))

    def test_delimiter(self):
        self.assertEquals(["foo", "bar"], TO_LIST("foo,bar", ","))
        self.assertEquals(["  foo", "bar  "], TO_LIST("  foo,bar  ", ","))
        self.assertEquals(["  \" foo\"", " bar  "], TO_LIST("  \" foo\", bar  ", ","))