Beispiel #1
0
class parser_tests:

    def __init__(self):
        self.sut = Parser()

    def test_parse_words_returns_word_list(self):
        result = self.sut.parse_words("Lorem ipsum")

        assert_equal(2, len(result))
        assert_equal("Lorem", result[0])
        assert_equal("ipsum", result[1])

    def test_parse_options_returns_logical_and_for_empty_string(self):
        result = self.sut.parse_options("")

        assert_equal(Logical.And, result)

    def test_parse_options_returns_logical_or_for_dash_o(self):
        result = self.sut.parse_options("-o")

        assert_equal(Logical.Or, result)

    def test_parse_options_returns_logical_and_for_any_other_value(self):
        result = self.sut.parse_options("xyz")

        assert_equal(Logical.And, result)
Beispiel #2
0
def main(argv=None):
    if argv is None:
        argv = sys.argv

    options = ""
    if "-o" in argv:
        options = "-o"
        argv.remove("-o")

    finder = Finder(Parser(), FileSystem(), Matcher())

    args = " ".join(argv[1:])
    print finder.find(args, options)
Beispiel #3
0
 def __init__(self):
     self.sut = Parser()
 def __init__(self):
     parser = Parser()
     fileSystem = FileSystem()
     matcher = Matcher()
     self.sut = Finder(parser, fileSystem, matcher)