diff options
| author | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
|---|---|---|
| committer | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
| commit | 7e2ccccace24636f29ddc210b94606abd4c7e42b (patch) | |
| tree | 545d43ea12671048956cafeb12303e84d601e571 /BaseTools/Tests/TestRegularExpression.py | |
| parent | 27b044605cd5f6b33a3d231576003850b3fe305b (diff) | |
| download | edk2-trunk.tar.xz | |
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'BaseTools/Tests/TestRegularExpression.py')
| -rw-r--r-- | BaseTools/Tests/TestRegularExpression.py | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/BaseTools/Tests/TestRegularExpression.py b/BaseTools/Tests/TestRegularExpression.py index 3e6c5f4463..c11591f104 100644 --- a/BaseTools/Tests/TestRegularExpression.py +++ b/BaseTools/Tests/TestRegularExpression.py @@ -1,48 +1,48 @@ -## @file
-# Routines for generating Pcd Database
-#
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-
-import unittest
-from Common.Misc import RemoveCComments
-from Workspace.BuildClassObject import ArrayIndex
-
-class TestRe(unittest.TestCase):
- def test_ccomments(self):
- TestStr1 = """ {0x01,0x02} """
- self.assertEquals(TestStr1, RemoveCComments(TestStr1))
-
- TestStr2 = """ L'TestString' """
- self.assertEquals(TestStr2, RemoveCComments(TestStr2))
-
- TestStr3 = """ 'TestString' """
- self.assertEquals(TestStr3, RemoveCComments(TestStr3))
-
- TestStr4 = """
- {CODE({
- {0x01, {0x02, 0x03, 0x04 }},// Data comment
- {0x01, {0x02, 0x03, 0x04 }},// Data comment
- })
- } /*
- This is multiple line comments
- The seconde line comment
- */
- // This is a comment
- """
- Expect_TestStr4 = """{CODE({
- {0x01, {0x02, 0x03, 0x04 }},
- {0x01, {0x02, 0x03, 0x04 }},
- })
- }"""
- self.assertEquals(Expect_TestStr4, RemoveCComments(TestStr4).strip())
-
- def Test_ArrayIndex(self):
- TestStr1 = """[1]"""
- self.assertEquals(['[1]'], ArrayIndex.findall(TestStr1))
-
- TestStr2 = """[1][2][0x1][0x01][]"""
- self.assertEquals(['[1]','[2]','[0x1]','[0x01]','[]'], ArrayIndex.findall(TestStr2))
-
-if __name__ == '__main__':
- unittest.main()
+## @file +# Routines for generating Pcd Database +# +# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent + +import unittest +from Common.Misc import RemoveCComments +from Workspace.BuildClassObject import ArrayIndex + +class TestRe(unittest.TestCase): + def test_ccomments(self): + TestStr1 = """ {0x01,0x02} """ + self.assertEquals(TestStr1, RemoveCComments(TestStr1)) + + TestStr2 = """ L'TestString' """ + self.assertEquals(TestStr2, RemoveCComments(TestStr2)) + + TestStr3 = """ 'TestString' """ + self.assertEquals(TestStr3, RemoveCComments(TestStr3)) + + TestStr4 = """ + {CODE({ + {0x01, {0x02, 0x03, 0x04 }},// Data comment + {0x01, {0x02, 0x03, 0x04 }},// Data comment + }) + } /* + This is multiple line comments + The seconde line comment + */ + // This is a comment + """ + Expect_TestStr4 = """{CODE({ + {0x01, {0x02, 0x03, 0x04 }}, + {0x01, {0x02, 0x03, 0x04 }}, + }) + }""" + self.assertEquals(Expect_TestStr4, RemoveCComments(TestStr4).strip()) + + def Test_ArrayIndex(self): + TestStr1 = """[1]""" + self.assertEquals(['[1]'], ArrayIndex.findall(TestStr1)) + + TestStr2 = """[1][2][0x1][0x01][]""" + self.assertEquals(['[1]','[2]','[0x1]','[0x01]','[]'], ArrayIndex.findall(TestStr2)) + +if __name__ == '__main__': + unittest.main() |
