def when_mismatch_with_missing_program(): expect(match_version("", "program not found")) == False expect(match_version("", "v1.2.3\nother not found")) == True
def when_match_with_dash_followed_by_path(): """Test that the output of `$ printenv DIRENV_DIR` can be matched.""" expect(match_version("-", "-/foo/bar")) == True
def when_match_with_slug_inside_path(): """Test that the output of `$ which python` (pyenv) can be matched.""" expect( match_version( ".pyenv", "Users/foobar/.pyenv/versions/2.7.14/bin/python")) == True
def when_match_with_version(): expect(match_version("1.", "v1.2.3")) == True
def when_mismatch_with_version(): expect(match_version("2.", "v1.2.3")) == False
def when_match_with_name(): expect(match_version("1.", "Foobar 1.2.3")) == True
def when_mismatch_with_name(): expect(match_version("2.", "Foobar 1.2.3")) == False
def when_mismatch(): expect(match_version("1.", "2.0")) == False
def when_mismatch_at_boundary(): expect(match_version("1.2", "1.23")) == False
def when_partial_match_at_boundary(): expect(match_version("1.2", "1.2.3")) == True
def when_partial_match(): expect(match_version("1.2.", "1.2.3")) == True
def when_exact_match(): expect(match_version("1.2.3", "1.2.3")) == True
def when_mismatch_inside(): expect(match_version("2.", "Foobar 1.2.3")) == False
def when_match_inside(): expect(match_version("1.", "Foobar 1.2.3")) == True