<commit_before>package vcs

import (
	"testing"
)

func TestVCSLookup(t *testing.T) {
	// TODO: Expand to make sure it detected the right vcs.
	urlList := map[string]struct {
		work bool
		t    Type
	}{
		"https://github.com/masterminds":                                   {work: false, t: Git},
		"https://github.com/Masterminds/VCSTestRepo":                       {work: true, t: Git},
		"https://bitbucket.org/mattfarina/testhgrepo":                      {work: true, t: Hg},
		"https://launchpad.net/govcstestbzrrepo/trunk":                     {work: true, t: Bzr},
		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo":       {work: true, t: Bzr},
		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo/trunk": {work: true, t: Bzr},
		"https://git.launchpad.net/govcstestgitrepo":                       {work: true, t: Git},
		"https://git.launchpad.net/~mattfarina/+git/mygovcstestgitrepo":    {work: true, t: Git},
		"http://farbtastic.googlecode.com/svn/":                            {work: true, t: Svn},
		"http://farbtastic.googlecode.com/svn/trunk":                       {work: true, t: Svn},
		"https://code.google.com/p/farbtastic":                             {work: false, t: Svn},
		"https://code.google.com/p/plotinum":                               {work: true, t: Hg},
		"https://example.com/foo/bar.git":                                  {work: true, t: Git},
		"https://example.com/foo/bar.svn":                                  {work: true, t: Svn},
		"https://example.com/foo/bar/baz.bzr":                              {work: true, t: Bzr},
		"https://example.com/foo/bar/baz.hg":                               {work: true, t: Hg},
		"https://gopkg.in/tomb.v1":                                         {work: true, t: Git},
		"https://golang.org/x/net":                                         {work: true, t: Git},
		"https://speter.net/go/exp/math/dec/inf":                           {work: true, t: Git},
		"<EMAIL>:Masterminds/vcs.git":                               {work: true, t: Git},
	}

	for u, c := range urlList {
		ty, _, err := detectVcsFromRemote(u)
		if err == nil && c.work == false {
			t.Errorf("Error detecting VCS from URL(%s)", u)
		}

		if err == ErrCannotDetectVCS && c.work == true {
			t.Errorf("Error detecting VCS from URL(%s)", u)
		}

		if err != nil && c.work == true {<commit_msg>Adding test for git scp style url outside of GitHub<commit_after>package vcs

import (
	"testing"
)

func TestVCSLookup(t *testing.T) {
	// TODO: Expand to make sure it detected the right vcs.
	urlList := map[string]struct {
		work bool
		t    Type
	}{
		"https://github.com/masterminds":                                   {work: false, t: Git},
		"https://github.com/Masterminds/VCSTestRepo":                       {work: true, t: Git},
		"https://bitbucket.org/mattfarina/testhgrepo":                      {work: true, t: Hg},
		"https://launchpad.net/govcstestbzrrepo/trunk":                     {work: true, t: Bzr},
		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo":       {work: true, t: Bzr},
		"https://launchpad.net/~mattfarina/+junk/mygovcstestbzrrepo/trunk": {work: true, t: Bzr},
		"https://git.launchpad.net/govcstestgitrepo":                       {work: true, t: Git},
		"https://git.launchpad.net/~mattfarina/+git/mygovcstestgitrepo":    {work: true, t: Git},
		"http://farbtastic.googlecode.com/svn/":                            {work: true, t: Svn},
		"http://farbtastic.googlecode.com/svn/trunk":                       {work: true, t: Svn},
		"https://code.google.com/p/farbtastic":                             {work: false, t: Svn},
		"https://code.google.com/p/plotinum":                               {work: true, t: Hg},
		"https://example.com/foo/bar.git":                                  {work: true, t: Git},
		"https://example.com/foo/bar.svn":                                  {work: true, t: Svn},
		"https://example.com/foo/bar/baz.bzr":                              {work: true, t: Bzr},
		"https://example.com/foo/bar/baz.hg":                               {work: true, t: Hg},
		"https://gopkg.in/tomb.v1":                                         {work: true, t: Git},
		"https://golang.org/x/net":                                         {work: true, t: Git},
		"https://speter.net/go/exp/math/dec/inf":                           {work: true, t: Git},
		"<EMAIL>:Masterminds/vcs.git":                               {work: true, t: Git},
		"<EMAIL>:foo.git":                                          {work: true, t: Git},
	}

	for u, c := range urlList {
		ty, _, err := detectVcsFromRemote(u)
		if err == nil && c.work == false {
			t.Errorf("Error detecting VCS from URL(%s)", u)
		}

		if err == ErrCannotDetectVCS && c.work == true {
			t.Errorf("Error detecting VCS from URL(%s)", u)
		}

		if err != nil && c.work == true {
{'fraction_non_alphanumeric': 0.16832298136645962, 'fraction_numerical': 0.00041407867494824016, 'mean_word_length': 1.6617079889807163, 'pattern_counts': {'":': 41, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 34, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3797176', 'n_tokens_mistral': 1746, 'n_tokens_neox': 1586, 'n_words': 330}