From: "Feng, Bob C" <bob.c.feng@intel.com>
To: edk2-devel@lists.01.org
Cc: Bob Feng <bob.c.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch 3/3] BaseTools: unit test for splitquoted function
Date: Sun, 3 Feb 2019 13:55:15 +0800 [thread overview]
Message-ID: <20190203055515.18336-4-bob.c.feng@intel.com> (raw)
In-Reply-To: <20190203055515.18336-1-bob.c.feng@intel.com>
unit test for splitquoted function
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
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.<BR>
+# 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
next prev parent reply other threads:[~2019-02-03 5:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-03 5:55 [Patch 0/3] BaseTools: Implement splitquoted function Feng, Bob C
2019-02-03 5:55 ` [Patch 1/3] BaseTools: Implement splitquoted function in Build tool Feng, Bob C
2019-02-04 15:38 ` Carsey, Jaben
2019-02-03 5:55 ` [Patch 2/3] BaseTools: Implement splitquoted function in UPT Feng, Bob C
2019-02-03 5:55 ` Feng, Bob C [this message]
2019-02-04 19:12 ` [Patch 0/3] BaseTools: Implement splitquoted function Laszlo Ersek
2019-02-12 12:23 ` Laszlo Ersek
2019-02-12 13:33 ` Gao, Liming
2019-02-12 14:02 ` Laszlo Ersek
2019-02-12 17:16 ` Philippe Mathieu-Daudé
2019-02-12 17:24 ` Laszlo Ersek
2019-02-14 2:51 ` Feng, Bob C
2019-02-14 3:23 ` Gao, Liming
2019-02-14 15:35 ` Laszlo Ersek
2019-02-15 14:35 ` Gao, Liming
2019-02-15 21:54 ` Laszlo Ersek
2019-02-14 15:32 ` Laszlo Ersek
2019-02-15 3:19 ` Feng, Bob C
2019-02-12 10:44 ` Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190203055515.18336-4-bob.c.feng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox