1""" Test suite for the code in msilib """
2import unittest
3from test.support import import_module
4msilib = import_module('msilib')
5
6class Test_make_id(unittest.TestCase):
7    #http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx
8    """The Identifier data type is a text string. Identifiers may contain the
9    ASCII characters A-Z (a-z), digits, underscores (_), or periods (.).
10    However, every identifier must begin with either a letter or an
11    underscore.
12    """
13
14    def test_is_no_change_required(self):
15        self.assertEqual(
16            msilib.make_id("short"), "short")
17        self.assertEqual(
18            msilib.make_id("nochangerequired"), "nochangerequired")
19        self.assertEqual(
20            msilib.make_id("one.dot"), "one.dot")
21        self.assertEqual(
22            msilib.make_id("_"), "_")
23        self.assertEqual(
24            msilib.make_id("a"), "a")
25        #self.assertEqual(
26        #    msilib.make_id(""), "")
27
28    def test_invalid_first_char(self):
29        self.assertEqual(
30            msilib.make_id("9.short"), "_9.short")
31        self.assertEqual(
32            msilib.make_id(".short"), "_.short")
33
34    def test_invalid_any_char(self):
35        self.assertEqual(
36            msilib.make_id(".s\x82ort"), "_.s_ort")
37        self.assertEqual    (
38            msilib.make_id(".s\x82o?*+rt"), "_.s_o___rt")
39
40
41if __name__ == '__main__':
42    unittest.main()
43