vcs_test.go 939 B

1234567891011121314151617181920212223242526272829303132
  1. package main
  2. import (
  3. "testing"
  4. )
  5. func TestParsing(t *testing.T) {
  6. type source struct {
  7. sourceurl string
  8. owner string
  9. repo string
  10. }
  11. neovim := source{sourceurl: "git+https://github.com/neovim/neovim.git"}
  12. neovim.owner, neovim.repo = parseSource(neovim.sourceurl)
  13. if neovim.owner != "neovim" || neovim.repo != "neovim" {
  14. t.Fatalf("Expected to find neovim/neovim, found %+v/%+v", neovim.owner, neovim.repo)
  15. }
  16. yay := source{sourceurl: "git://github.com/jguer/yay.git#branch=master"}
  17. yay.owner, yay.repo = parseSource(yay.sourceurl)
  18. if yay.owner != "jguer" || yay.repo != "yay" {
  19. t.Fatalf("Expected to find jguer/yay, found %+v/%+v", yay.owner, yay.repo)
  20. }
  21. ack := source{sourceurl: "git://github.com/davidgiven/ack"}
  22. ack.owner, ack.repo = parseSource(ack.sourceurl)
  23. if ack.owner != "davidgiven" || ack.repo != "ack" {
  24. t.Fatalf("Expected to find davidgiven/ack, found %+v/%+v", ack.owner, ack.repo)
  25. }
  26. }