yay/vcs_test.go

33 lines
939 B
Go
Raw Normal View History

package main
2017-05-01 03:23:03 +02:00
import (
"testing"
)
func TestParsing(t *testing.T) {
type source struct {
sourceurl string
owner string
repo string
}
neovim := source{sourceurl: "git+https://github.com/neovim/neovim.git"}
2017-08-07 11:53:20 +02:00
neovim.owner, neovim.repo = parseSource(neovim.sourceurl)
2017-05-01 03:23:03 +02:00
if neovim.owner != "neovim" || neovim.repo != "neovim" {
t.Fatalf("Expected to find neovim/neovim, found %+v/%+v", neovim.owner, neovim.repo)
}
yay := source{sourceurl: "git://github.com/jguer/yay.git#branch=master"}
2017-08-07 11:53:20 +02:00
yay.owner, yay.repo = parseSource(yay.sourceurl)
2017-05-01 03:23:03 +02:00
if yay.owner != "jguer" || yay.repo != "yay" {
t.Fatalf("Expected to find jguer/yay, found %+v/%+v", yay.owner, yay.repo)
}
ack := source{sourceurl: "git://github.com/davidgiven/ack"}
2017-08-07 11:53:20 +02:00
ack.owner, ack.repo = parseSource(ack.sourceurl)
2017-05-01 03:23:03 +02:00
if ack.owner != "davidgiven" || ack.repo != "ack" {
t.Fatalf("Expected to find davidgiven/ack, found %+v/%+v", ack.owner, ack.repo)
}
}