コード例 #1
0
ファイル: test_commands.py プロジェクト: sshellmann/trysed
 def test_invalid_command(self):
     with pytest.raises(InvalidCommand):
         parse("su")
         parse("sed")
         parse("ls | less /etc/hosts")
コード例 #2
0
ファイル: test_commands.py プロジェクト: sshellmann/trysed
 def test_parsing(self):
     commands = parse('cat dog | sed -e "s/DOG/CAT/g"')
     assert commands == [['cat', 'dog'], ['sed', '-e', '"s/DOG/CAT/g"']]
コード例 #3
0
ファイル: test_commands.py プロジェクト: sshellmann/trysed
 def test_unended_string(self):
     with pytest.raises(InStringError):
         parse("'ls | cat")
         parse('cat dog "dog')
コード例 #4
0
ファイル: test_commands.py プロジェクト: sshellmann/trysed
 def test_invalid_char(self):
     parse("cat dog_bird Animals")
     parse('sed -e "s/.\\xanimal/dogbird#$%/g"')
     with pytest.raises(InvalidCommand):
         parse("cat dog.bird")
         parse("cat $cat")
コード例 #5
0
ファイル: test_commands.py プロジェクト: sshellmann/trysed
 def test_single_command_only(self):
     with pytest.raises(SingleCommandOnly):
         parse("ls; less /etc/hosts")