-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun_test.go
More file actions
34 lines (31 loc) · 806 Bytes
/
run_test.go
File metadata and controls
34 lines (31 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package gitreceive
import (
"testing"
)
func TestReadLine(t *testing.T) {
//readLine() expects a line with two spaces.
good := "foo bar car"
foo, bar, car, err := readLine(good)
if err != nil {
t.Errorf("Expected err to be nil, got '%v'", err)
}
if foo != "foo" {
t.Errorf("Expected 'foo', got '%s'", foo)
}
if bar != "bar" {
t.Errorf("Expected 'bar', got '%s'", bar)
}
if car != "car" {
t.Errorf("Expected 'car', got '%s'", car)
}
bad := "foo bar"
if _, _, _, err = readLine(bad); err == nil {
t.Error("Expected err to be not nil, got nil")
}
}
func TestRun(t *testing.T) {
// NOTE(bacongobbler): not much we can test at this time other than it fails based on bad setup
if err := Run(nil, nil, nil, nil); err == nil {
t.Errorf("expected error to be non-nil, got nil")
}
}