forked from frerich/clcache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
32 lines (23 loc) · 1.17 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import unittest
import clcache
class TestSplitCommandsFile(unittest.TestCase):
def _genericTest(self, fileContents, expectedOutput):
splitted = clcache.splitCommandsFile(fileContents)
self.assertEqual(splitted, expectedOutput)
def testBasic(self):
self._genericTest('-A -B -C',
['-A', '-B', '-C'])
def testSlashes(self):
self._genericTest('-A -I..\\.. -C',
['-A', '-I..\\..', '-C'])
def testDubleQuotes(self):
self._genericTest('"-IC:\\Program Files\\Lib1" "-IC:\\Program Files\\Lib2" -I"..\\.."',
['-IC:\\Program Files\\Lib1', '-IC:\\Program Files\\Lib2', '-I"..\\.."'])
def testEscapedQuotes(self):
self._genericTest('"-DWEBRTC_SVNREVISION=\\"Unavailable(issue687)\\"" -D_WIN32_WINNT=0x0602',
['-DWEBRTC_SVNREVISION="Unavailable(issue687)"', '-D_WIN32_WINNT=0x0602'])
def testEscapedDefine(self):
self._genericTest('-D"MAX_REPORT_COUNT=L\\"999\\"" -D_WIN32_WINNT=0x0602',
['-DMAX_REPORT_COUNT=L"999"', '-D_WIN32_WINNT=0x0602'])
if __name__ == '__main__':
unittest.main()