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