Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

54 linhas
1.2 KiB

  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. //
  3. // Use of this source code is governed by a BSD-style
  4. // license that can be found in the LICENSE file or at
  5. // https://developers.google.com/open-source/licenses/bsd.
  6. package gosrc
  7. import (
  8. "testing"
  9. )
  10. var goodImportPaths = []string{
  11. "github.com/user/repo",
  12. "github.com/user/repo/src/pkg/compress/somethingelse",
  13. "github.com/user/repo/src/compress/gzip",
  14. "github.com/user/repo/src/pkg",
  15. "camlistore.org/r/p/camlistore",
  16. "example.com/foo.git",
  17. "launchpad.net/~user/foo/trunk",
  18. "launchpad.net/~user/+junk/version",
  19. "github.com/user/repo/_ok/x",
  20. "exampleproject.com",
  21. }
  22. var badImportPaths = []string{
  23. "foobar",
  24. "foo.",
  25. ".bar",
  26. "favicon.ico",
  27. "github.com/user/repo/.ignore/x",
  28. }
  29. func TestIsValidRemotePath(t *testing.T) {
  30. for _, importPath := range goodImportPaths {
  31. if !IsValidRemotePath(importPath) {
  32. t.Errorf("isBadImportPath(%q) -> true, want false", importPath)
  33. }
  34. for _, s := range services {
  35. if _, err := s.match(importPath); err != nil {
  36. t.Errorf("match(%#v) → error %v", importPath, err)
  37. break
  38. }
  39. }
  40. }
  41. for _, importPath := range badImportPaths {
  42. if IsValidRemotePath(importPath) {
  43. t.Errorf("isBadImportPath(%q) -> false, want true", importPath)
  44. }
  45. }
  46. }