Esempio n. 1
0
 def test_split_input3(self):
     """test simple input (with quotes)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo "bar x" y')
     self.assertEqual(data, ['foo', 'bar x', 'y'])
Esempio n. 2
0
 def test_split_input4(self):
     """test input (multiple quotes)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo "bar\nx" "y z"')
     self.assertEqual(data, ['foo', 'bar\nx', 'y z'])
Esempio n. 3
0
 def test_split_input2(self):
     """test simple input (multiple elements)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo bar')
     self.assertEqual(data, ['foo', 'bar'])
Esempio n. 4
0
 def test_check_input5(self):
     """test simple quoted input"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('"foo"'))
Esempio n. 5
0
 def test_check_input7(self):
     """test input with missing quote (multiple quotes)"""
     shell = AbstractShell(MockRenderer())
     # "bar x " is recognized correctly
     self.assertFalse(shell._check_input('foo "bar x " "bla foobar'))
Esempio n. 6
0
 def test_check_input1(self):
     """test simple input"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo bar'))
Esempio n. 7
0
 def test_check_input3(self):
     """test input with mulitple quotes"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo "bar x" "x y z"'))
Esempio n. 8
0
 def test_check_input5(self):
     """test simple quoted input"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('"foo"'))
Esempio n. 9
0
 def test_check_input6(self):
     """test input with missing quote"""
     shell = AbstractShell(MockRenderer())
     self.assertFalse(shell._check_input('foo "bar x bla'))
Esempio n. 10
0
 def test_check_input3(self):
     """test input with mulitple quotes"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo "bar x" "x y z"'))
Esempio n. 11
0
 def test_check_input4(self):
     """test quote empty str"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('x "" "b"'))
Esempio n. 12
0
 def test_check_input2(self):
     """test simple input with quotes"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo "bar x"'))
Esempio n. 13
0
 def test_check_input1(self):
     """test simple input"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo bar'))
Esempio n. 14
0
 def test_split_input5(self):
     """test input (multiple whitespace)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('"foo  bar"')
     self.assertEqual(data, ['foo  bar'])
Esempio n. 15
0
 def test_split_input4(self):
     """test input (multiple quotes)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo "bar\nx" "y z"')
     self.assertEqual(data, ['foo', 'bar\nx', 'y z'])
Esempio n. 16
0
 def test_check_input7(self):
     """test input with missing quote (multiple quotes)"""
     shell = AbstractShell(MockRenderer())
     # "bar x " is recognized correctly
     self.assertFalse(shell._check_input('foo "bar x " "bla foobar'))
Esempio n. 17
0
 def test_split_input5(self):
     """test input (multiple whitespace)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('"foo  bar"')
     self.assertEqual(data, ['foo  bar'])
Esempio n. 18
0
 def test_check_input9(self):
     """test incorrect input (missing whitespace before quote)"""
     shell = AbstractShell(MockRenderer())
     self.assertRaises(ShellSyntaxError, shell._check_input, 'foo x"bar"')
Esempio n. 19
0
 def test_check_input2(self):
     """test simple input with quotes"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('foo "bar x"'))
Esempio n. 20
0
 def test_check_input11(self):
     """test incorrect input (embedded quote)"""
     shell = AbstractShell(MockRenderer())
     self.assertRaises(ShellSyntaxError, shell._check_input,
                       'foo "bar " x" xy"')
Esempio n. 21
0
 def test_check_input4(self):
     """test quote empty str"""
     shell = AbstractShell(MockRenderer())
     self.assertTrue(shell._check_input('x "" "b"'))
Esempio n. 22
0
 def test_split_input1(self):
     """test simple input"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo')
     self.assertEqual(data, ['foo'])
Esempio n. 23
0
 def test_check_input6(self):
     """test input with missing quote"""
     shell = AbstractShell(MockRenderer())
     self.assertFalse(shell._check_input('foo "bar x bla'))
Esempio n. 24
0
 def test_split_input2(self):
     """test simple input (multiple elements)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo bar')
     self.assertEqual(data, ['foo', 'bar'])
Esempio n. 25
0
 def test_split_input1(self):
     """test simple input"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo')
     self.assertEqual(data, ['foo'])
Esempio n. 26
0
 def test_split_input3(self):
     """test simple input (with quotes)"""
     shell = AbstractShell(MockRenderer())
     data = shell._split_input('foo "bar x" y')
     self.assertEqual(data, ['foo', 'bar x', 'y'])