示例#1
0
 def runCommandLine(self, text):
     commands = list(lineSplitter(text))
     nCommands = len(commands)
     for i, command in enumerate(commands, start=1):
         if self.runCommand(command, i, nCommands) is False:
             return False
     return True
示例#2
0
 def testEmptyString(self):
     """An empty string should result in a list with an empty string."""
     self.assertEqual([''], list(lineSplitter('')))
示例#3
0
 def testEscaped(self):
     """An escaped | should result in one field, with the escape remvoed."""
     self.assertEqual([r'echo hi | wc -c'],
                      list(lineSplitter(r'echo hi \| wc -c')))
示例#4
0
 def testPlainStrings(self):
     """An unescaped | should result in the two expected fields."""
     self.assertEqual(['hello ', ' there'],
                      list(lineSplitter('hello | there')))
示例#5
0
 def testString(self):
     """A string with no | should result in the same string."""
     self.assertEqual(['hello'], list(lineSplitter('hello')))