]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Tests/CheckUnicodeSourceFiles.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Tests / CheckUnicodeSourceFiles.py
index 2eeb0f551d7e1d5fa6d3094e11a6b70ecb339c59..1502402619e17aa1e237b39925143af58c490a25 100644 (file)
@@ -3,13 +3,7 @@
 #\r
 #  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
 #\r
-#  This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 ##\r
@@ -110,10 +104,21 @@ class Tests(TestTools.BaseToolsTest):
         # This test makes sure that BaseTools rejects these characters\r
         # if seen in a .uni file.\r
         #\r
-        data = codecs.BOM_UTF16_LE + '//\x01\xd8 '\r
+        data = codecs.BOM_UTF16_LE + b'//\x01\xd8 '\r
 \r
         self.CheckFile(encoding=None, shouldPass=False, string=data)\r
 \r
+    def testValidUtf8File(self):\r
+        self.CheckFile(encoding='utf_8', shouldPass=True)\r
+\r
+    def testValidUtf8FileWithBom(self):\r
+        #\r
+        # Same test as testValidUtf8File, but add the UTF-8 BOM\r
+        #\r
+        data = codecs.BOM_UTF8 + codecs.encode(self.SampleData, 'utf_8')\r
+\r
+        self.CheckFile(encoding=None, shouldPass=True, string=data)\r
+\r
     def test32bitUnicodeCharInUtf8File(self):\r
         data = u'''\r
             #langdef en-US "English"\r
@@ -150,7 +155,7 @@ class Tests(TestTools.BaseToolsTest):
         # This test makes sure that BaseTools rejects these characters\r
         # if seen in a .uni file.\r
         #\r
-        data = '\xed\xa0\x81'\r
+        data = b'\xed\xa0\x81'\r
 \r
         self.CheckFile(encoding=None, shouldPass=False, string=data)\r
 \r
@@ -159,7 +164,7 @@ class Tests(TestTools.BaseToolsTest):
         # Same test as testSurrogatePairUnicodeCharInUtf8File, but add\r
         # the UTF-8 BOM\r
         #\r
-        data = codecs.BOM_UTF8 + '\xed\xa0\x81'\r
+        data = codecs.BOM_UTF8 + b'\xed\xa0\x81'\r
 \r
         self.CheckFile(encoding=None, shouldPass=False, string=data)\r
 \r