forked from marouni/adr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
projectconfig_test.go
49 lines (40 loc) · 1.21 KB
/
projectconfig_test.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"testing"
)
func TestAppendProject(t *testing.T) {
adrConfig := AdrConfig{nil}
adrConfig, _ = addProject("hello", adrConfig)
adrConfig, _ = addProject("is/it/me/you/are/looking/for", adrConfig)
count := len(adrConfig.Projects)
if count != 2 {
t.Errorf("Projects not 2, rather %d", count)
}
}
func TestAppendProjectOnlyOnce(t *testing.T) {
adrConfig := AdrConfig{nil}
adrConfig, _ = addProject("hello", adrConfig)
adrConfig, _ = addProject("hello", adrConfig)
count := len(adrConfig.Projects)
if count != 1 {
t.Errorf("Projects not 1, rather %d", count)
}
}
func TestAppendProjectOnSubPathShouldNotWork(t *testing.T) {
adrConfig := AdrConfig{nil}
adrConfig, _ = addProject("hello", adrConfig)
adrConfig, _ = addProject("hello/is/it/me/you/are/looking/for", adrConfig)
count := len(adrConfig.Projects)
if count != 1 {
t.Errorf("Projects not 1, rather %d", count)
}
}
func TestAppendProjectOnSuperPathShouldNotWork(t *testing.T) {
adrConfig := AdrConfig{nil}
adrConfig, _ = addProject("hello/is/it/me/you/are/looking/for", adrConfig)
adrConfig, _ = addProject("hello", adrConfig)
count := len(adrConfig.Projects)
if count != 1 {
t.Errorf("Projects not 1, rather %d", count)
}
}