@@ -0,0 +1,2116 @@
+import mock%0Aimport re%0A%0Afrom tools import Tool%0Afrom testing_utils import calls_matching_re%0A%0A%0Aclass TestTool(Tool):%0A    def process_line(self, dirname, line):%0A        return None%0A%0A    def get_file_extensions(self):%0A        return %5B%22.exe%22%5D%0A%0A    def get_command(self, dirname):%0A        return %22example-cmd%22%0A%0A%0Adef test_find_searches_dirname():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    t = TestTool(m)%0A    t.invoke('/woobie/')%0A%0A    assert len(calls_matching_re(%0A        m, re.compile(r'find /woobie/'))) %3E 0%0A%0A%0Adef test_find_includes_extension():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    t = TestTool(m)%0A    t.invoke('/woobie/')%0A%0A    assert len(calls_matching_re(%0A        m, re.compile(r'-name %22%5C*.exe%22'))) %3E 0%0A%0A%0Adef test_find_includes_multiple_extensions_with_dash_o():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    t = TestTool(m)%0A    t.get_file_extensions = lambda: %5B'.a', '.b'%5D%0A    t.invoke('/woobie/')%0A%0A    assert len(calls_matching_re(%0A        m, re.compile(r'-name %22%5C*.a%22 -o -name %22%5C*.b%22'))) %3E 0%0A%0A%0Adef test_invoke_runs_command():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    t = TestTool(m)%0A    t.invoke('/woobie/')%0A%0A    assert len(calls_matching_re(%0A        m, re.compile(%22example-cmd%22))) == 1%0A%0A%0Adef test_calls_process_line_for_each_line():%0A    m = mock.Mock()%0A    m.return_value = %221%5Cn2%5Cn3%22%0A    t = TestTool(m)%0A    process_mock = mock.Mock()%0A    process_mock.return_value = None%0A    t.process_line = process_mock%0A    t.invoke('/woobie/')%0A%0A    assert process_mock.call_count == 3%0A%0A%0Adef test_ignores_none_results_from_process_line():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    process_mock = mock.Mock()%0A    process_mock.return_value = None%0A    t = TestTool(m)%0A    t.process_line = process_mock%0A    retval = t.invoke('/woobie/')%0A%0A    assert 0 == len(retval.keys())%0A%0A%0Adef test_appends_process_line_results_to_results():%0A    m = mock.Mock()%0A    m.return_value = %22%22%0A    process_mock = mock.Mock()%0A    process_mock.return_value = (1, 2, 3)%0A    t = TestTool(m)%0A    t.process_line = process_mock%0A    retval = t.invoke('/woobie/')%0A%0A    assert 1 == len(retval.keys())%0A    assert retval%5B1%5D%5B2%5D%5B0%5D == 3%0A

add a few tests around tooling abstraction