github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/modules/git_test.go (about)

     1  package modules
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/lmorg/murex/test"
     7  	"github.com/lmorg/murex/test/count"
     8  )
     9  
    10  func TestGitInstalled(t *testing.T) {
    11  	test.InstalledDepsTest(t, "git")
    12  }
    13  
    14  func TestGitUriParser(t *testing.T) {
    15  	URIs := []string{
    16  		"git@github.com:/lmorg/murex-module-murex-dev",
    17  		"git@github.com:/lmorg/murex-module-murex-dev.git",
    18  		"https://github.com/lmorg/murex-module-murex-dev",
    19  		"https://github.com/lmorg/murex-module-murex-dev.git",
    20  	}
    21  
    22  	count.Tests(t, len(URIs))
    23  
    24  	expected := "murex-module-murex-dev"
    25  
    26  	for _, test := range URIs {
    27  		actual, err := gitGetPath(test)
    28  		if actual != expected || err != nil {
    29  			t.Errorf("gitGetPath() failed to locate clone destination from URI")
    30  			t.Log("  test:    ", test)
    31  			t.Log("  expected:", expected)
    32  			t.Log("  actual:  ", actual)
    33  			t.Log("  error:   ", err)
    34  		}
    35  	}
    36  }