Also, fix unit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81194
91177308-0d34-0410-b5e6-
96231b3b80d8
-import ShUtil
-
class Command:
def __init__(self, args, redirects):
self.args = list(args)
print >>file, quoted,
# For debugging / validation.
+ import ShUtil
dequoted = list(ShUtil.ShLexer(quoted).lex())
if dequoted != [arg]:
raise NotImplementedError,'Unable to quote %r' % arg
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:]
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)))