forked from hashicorp/terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.go
More file actions
55 lines (44 loc) · 1 KB
/
Copy pathutil_test.go
File metadata and controls
55 lines (44 loc) · 1 KB
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
50
51
52
53
54
55
package github
import (
"testing"
)
func TestAccGithubUtilRole_validation(t *testing.T) {
cases := []struct {
Value string
ErrCount int
}{
{
Value: "invalid",
ErrCount: 1,
},
{
Value: "valid_one",
ErrCount: 0,
},
{
Value: "valid_two",
ErrCount: 0,
},
}
validationFunc := validateValueFunc([]string{"valid_one", "valid_two"})
for _, tc := range cases {
_, errors := validationFunc(tc.Value, "test_arg")
if len(errors) != tc.ErrCount {
t.Fatalf("Expected 1 validation error")
}
}
}
func TestAccGithubUtilTwoPartID(t *testing.T) {
partOne, partTwo := "foo", "bar"
id := buildTwoPartID(&partOne, &partTwo)
if id != "foo:bar" {
t.Fatalf("Expected two part id to be foo:bar, actual: %s", id)
}
parsedPartOne, parsedPartTwo := parseTwoPartID(id)
if parsedPartOne != "foo" {
t.Fatalf("Expected parsed part one foo, actual: %s", parsedPartOne)
}
if parsedPartTwo != "bar" {
t.Fatalf("Expected parsed part two bar, actual: %s", parsedPartTwo)
}
}