79
79
script._script_to_commands(story))
82
class TestScriptExecution(script.TestCaseWithScript):
84
def test_unknown_command(self):
85
self.assertRaises(SyntaxError, self.run_script, 'foo')
88
class TestCat(script.TestCaseWithScript):
90
def test_cat_usage(self):
91
self.assertRaises(SyntaxError, self.run_script, 'cat foo bar baz')
93
def test_cat_input_to_output(self):
94
out, err = self.run_command(['cat'], ['content\n'], ['content\n'], None)
96
def test_cat_file_to_output(self):
97
self.build_tree_contents([('file', 'content\n')])
98
out, err = self.run_command(['cat', 'file'], None, ['content\n'], None)
100
def test_cat_input_to_file(self):
101
out, err = self.run_command(['cat', '>file'], ['content\n'], None, None)
102
self.assertFileEqual('content\n', 'file')
104
def test_cat_file_to_file(self):
105
self.build_tree_contents([('file', 'content\n')])
106
out, err = self.run_command(['cat', 'file', '>file2'], None, None, None)
107
self.assertFileEqual('content\n', 'file2')