From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 89BD121BADAB9 for ; Sat, 2 Feb 2019 21:55:28 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2019 21:55:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,555,1539673200"; d="scan'208";a="296864419" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga005.jf.intel.com with ESMTP; 02 Feb 2019 21:55:27 -0800 From: "Feng, Bob C" To: edk2-devel@lists.01.org Cc: Bob Feng , Liming Gao Date: Sun, 3 Feb 2019 13:55:15 +0800 Message-Id: <20190203055515.18336-4-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190203055515.18336-1-bob.c.feng@intel.com> References: <20190203055515.18336-1-bob.c.feng@intel.com> MIME-Version: 1.0 Subject: [Patch 3/3] BaseTools: unit test for splitquoted function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2019 05:55:28 -0000 Content-Transfer-Encoding: 8bit unit test for splitquoted function Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao --- BaseTools/Tests/TestStringSplit.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/BaseTools/Tests/TestStringSplit.py b/BaseTools/Tests/TestStringSplit.py new file mode 100644 index 0000000000..f24200ecfc --- /dev/null +++ b/BaseTools/Tests/TestStringSplit.py @@ -0,0 +1,38 @@ +## @file +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +import unittest +from AutoGen.UniClassObject import splitquoted + +class TestStringSplit(unittest.TestCase): + def test_split_string(self): + TestStr1 = """ 'hello "world"' """ + ExpStr1 = ['hello "world"'] + self.assertEqual(ExpStr1, splitquoted(TestStr1)) + + TestStr1 = """ "hello 'world'" """ + ExpStr1 = ["hello 'world'"] + self.assertEqual(ExpStr1, splitquoted(TestStr1)) + + TestStr1 = """ "hello 'world'" 'hello "abcd"' """ + ExpStr1 = ["hello 'world'", 'hello "abcd"'] + self.assertEqual(ExpStr1, splitquoted(TestStr1)) + + TestStr1 = """ "hello 'world'" 'hello "abcd"' \t\n\r\v\f \x64 """ + ExpStr1 = ["hello 'world'", 'hello "abcd"', '\x64'] + self.assertEqual(ExpStr1, splitquoted(TestStr1)) + + TestStr1 = """ "hello 'world'" 'hello "abcd" \t\n\r\v\f \x64' """ + ExpStr1 = ["hello 'world'", 'hello "abcd" \t\n\r\v\f \x64'] + self.assertEqual(ExpStr1, splitquoted(TestStr1)) + +if __name__ == '__main__': + unittest.main() -- 2.20.1.windows.1