We test a simple case of UTF-8 with and without the UTF-8 BOM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Yingke D Liu <yingke.d....@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
---
 BaseTools/Tests/CheckUnicodeSourceFiles.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/BaseTools/Tests/CheckUnicodeSourceFiles.py 
b/BaseTools/Tests/CheckUnicodeSourceFiles.py
index 2eeb0f5..6ae62f1 100644
--- a/BaseTools/Tests/CheckUnicodeSourceFiles.py
+++ b/BaseTools/Tests/CheckUnicodeSourceFiles.py
@@ -114,6 +114,17 @@ class Tests(TestTools.BaseToolsTest):
 
         self.CheckFile(encoding=None, shouldPass=False, string=data)
 
+    def testValidUtf8File(self):
+        self.CheckFile(encoding='utf_8', shouldPass=True)
+
+    def testValidUtf8FileWithBom(self):
+        #
+        # Same test as testValidUtf8File, but add the UTF-8 BOM
+        #
+        data = codecs.BOM_UTF8 + codecs.encode(self.SampleData, 'utf_8')
+
+        self.CheckFile(encoding=None, shouldPass=True, string=data)
+
     def test32bitUnicodeCharInUtf8File(self):
         data = u'''
             #langdef en-US "English"
-- 
2.1.4


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to