예제 #1
0
 def test_simple(self):
     args = [
         '/usr/bin/dd', 'iflag=direct',
         'if=/dev/a70a4106-24f2-4599-be3e-934fee6e4499/metadata', 'bs=4096',
         'count=1'
     ]
     line = ' '.join(args)
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #2
0
 def test_empty(self):
     self.assertEquals(cmdutils._list2cmdline([]), "")
예제 #3
0
 def test_empty_arg(self):
     self.assertEquals(cmdutils._list2cmdline(['a', '', 'b']), "a '' b")
예제 #4
0
 def test_single_quote(self):
     args = ["don't", "try 'this'", "'at home'"]
     line = r"'don'\''t' 'try '\''this'\''' ''\''at home'\'''"
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #5
0
 def test_safe(self):
     # Stolen from pipes._safechars
     line = ' '.join('%+,-./0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdef'
                     'ghijklmnopqrstuvwxyz')
     args = line.split()
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #6
0
 def test_unsafe(self):
     args = [c for c in '><*?[]`$|;&()#$\\"']
     line = ' '.join("'" + c + "'" for c in args)
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #7
0
 def test_whitespace(self):
     args = ['a b', ' c ', 'd\t', '\ne']
     line = "'a b' ' c ' 'd\t' '\ne'"
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #8
0
 def test_simple(self):
     args = ['/usr/bin/dd', 'iflag=direct',
             'if=/dev/a70a4106-24f2-4599-be3e-934fee6e4499/metadata',
             'bs=4096', 'count=1']
     line = ' '.join(args)
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #9
0
 def test_empty_arg(self):
     self.assertEquals(cmdutils._list2cmdline(['a', '', 'b']), "a '' b")
예제 #10
0
 def test_single_quote(self):
     args = ["don't", "try 'this'", "'at home'"]
     line = r"'don'\''t' 'try '\''this'\''' ''\''at home'\'''"
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #11
0
 def test_safe(self):
     # Stolen from pipes._safechars
     line = ' '.join('%+,-./0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdef'
                     'ghijklmnopqrstuvwxyz')
     args = line.split()
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #12
0
 def test_unsafe(self):
     args = [c for c in '><*?[]`$|;&()#$\\"']
     line = ' '.join("'" + c + "'" for c in args)
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #13
0
 def test_whitespace(self):
     args = ['a b', ' c ', 'd\t', '\ne']
     line = "'a b' ' c ' 'd\t' '\ne'"
     self.assertEquals(cmdutils._list2cmdline(args), line)
예제 #14
0
 def test_empty(self):
     self.assertEquals(cmdutils._list2cmdline([]), "")