зеркало из https://github.com/golang/dep.git
add initial unit tests for init
Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
Родитель
a182e30515
Коммит
2a0d87b21d
|
@ -0,0 +1,31 @@
|
|||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestContains(t *testing.T) {
|
||||
a := []string{"a", "b", "abcd"}
|
||||
|
||||
if !contains(a, "a") {
|
||||
t.Fatal("expected array to contain 'a'")
|
||||
}
|
||||
if contains(a, "d") {
|
||||
t.Fatal("expected array to not contain 'd'")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsStdLib(t *testing.T) {
|
||||
tests := map[string]bool{
|
||||
"github.com/sirupsen/logrus": false,
|
||||
"encoding/json": true,
|
||||
"golang.org/x/net/context": false,
|
||||
"net/context": true,
|
||||
".": false,
|
||||
}
|
||||
|
||||
for p, e := range tests {
|
||||
b := isStdLib(p)
|
||||
if b != e {
|
||||
t.Fatalf("%s: expected %t got %t", p, e, b)
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче