Debian Codegraph @

storage/internal/metadata/validation_test.go

raw symbols SCIP
1 package metadatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/
2
3 import "testingscip-go gomod github.com/golang/go/src go1.13 testing/"
4
5 func TestValidationCSharpKeywordsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/TestValidationCSharpKeywords().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
6 for key := range cSharpKeywordsscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/cSharpKeywords. {
7 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Testing %q", key)
8
9 err := Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/Validate().(map[string]string{
10 key: "value",
11 })
12 if err == nil {
13 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected an error but didn't get one for %q", key)
14 }
15 }
16 }
17
18 func TestValidationscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/TestValidation().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) {
19 testData := []struct {
20 Input string
21 ShouldBeValid bool
22 }{
23 {
24 Input: "",
25 ShouldBeValid: false,
26 },
27 {
28 Input: "abc123",
29 ShouldBeValid: true,
30 },
31 {
32 Input: "_abc123",
33 ShouldBeValid: true,
34 },
35 {
36 Input: "123abc",
37 ShouldBeValid: false,
38 },
39 {
40 Input: "a_123abc",
41 ShouldBeValid: true,
42 },
43 {
44 Input: "abc_123",
45 ShouldBeValid: true,
46 },
47 {
48 Input: "abc123_",
49 ShouldBeValid: true,
50 },
51 {
52 Input: "ABC123",
53 ShouldBeValid: true,
54 },
55 }
56
57 for _, v := range testData {
58 t.Logfscip-go gomod github.com/golang/go/src go1.13 testing/common#Logf().("[DEBUG] Testing %q", v.Input)
59
60 err := Validatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/internal/metadata`/Validate().(map[string]string{
61 v.Input: "value",
62 })
63 actual := err == nil
64 if v.ShouldBeValid != actual {
65 t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("Expected %t but got %t for %q", v.ShouldBeValid, actual, v.Input)
66 }
67 }
68 }