Fix typo that worked on python 2.6.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 8 Sep 2009 05:46:28 +0000 (05:46 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 8 Sep 2009 05:46:28 +0000 (05:46 +0000)
Also, fix unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81194 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/ShCommands.py
utils/lit/TclUtil.py

index be3e680e9e0e05f0b7297bd96101ee7ac1f20472..4550437ce227236b99c88d8f6c72b8f1313093d8 100644 (file)
@@ -1,5 +1,3 @@
-import ShUtil
-
 class Command:
     def __init__(self, args, redirects):
         self.args = list(args)
@@ -26,6 +24,7 @@ class Command:
             print >>file, quoted,
 
             # For debugging / validation.
+            import ShUtil
             dequoted = list(ShUtil.ShLexer(quoted).lex())
             if dequoted != [arg]:
                 raise NotImplementedError,'Unable to quote %r' % arg
index da7659de8578a50ec8f27c5b8a4bb6c12719cfd6..4a3f34508d64a8bd43742cbb75bd6d53a63b246d 100644 (file)
@@ -184,7 +184,7 @@ class TclExecCommand:
     def parse_redirect(self, tok, length):
         if len(tok) == length:
             arg = self.lex()
-            if next is None:
+            if arg is None:
                 raise ValueError,'Missing argument to %r redirection' % tok
         else:
             tok,arg = tok[:length],tok[length:]
@@ -310,11 +310,11 @@ class TestTclExecCommand(unittest.TestCase):
         self.assertEqual(self.parse('echo hello > a >b >>c 2> d |& e'),
                          (False, False,
                           Pipeline([Command(['echo', 'hello'],
-                                            [(('>',),'a'),
+                                            [(('>&',2),'1'),
+                                             (('>',),'a'),
                                              (('>',),'b'),
                                              (('>>',),'c'),
-                                             (('>',2),'d'),
-                                             (('>&',2),'1')]),
+                                             (('>',2),'d')]),
                                     Command(['e'], [])],
                                    False, True)))