Skip to content

Commit

Permalink
Fix formating and add new versions of Golang to CI (#177)
Browse files Browse the repository at this point in the history
* Reformat code in test

Reformat code in test to prevent different formating with go fmt on go
1.11 and 1.12
  • Loading branch information
Aliaksei Burau authored Oct 28, 2019
1 parent a67c9e2 commit ee168fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
go:
- "1.9"
- "1.10"
- "1.11"
- "1.12"
- "1.13"

env:
- DEP_VERSION="0.4.1"
Expand Down
21 changes: 11 additions & 10 deletions gateway/field_presence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
)

func TestAnnotator(t *testing.T) {
for input, expect := range map[string]metadata.MD{
``: metadata.MD{fieldPresenceMetaKey: nil},
`{}`: metadata.MD{fieldPresenceMetaKey: nil},
`{`: nil,
`{"objects":[{"one": {"two":"a", "three":[]}, "four": 5}, {"one":{"two":"a", "three":[]}, "four": 5}]}`: {fieldPresenceMetaKey: []string{"Four$One.Two$One.Three", "Four$One.Two$One.Three"}},
`{"one":{"two":"a", "three":[]}, "four": 5}`: {fieldPresenceMetaKey: []string{"Four$One.Two$One.Three"}},
`{"one": {}}`: {fieldPresenceMetaKey: []string{"One"}},
`{
tests := map[string]metadata.MD{}
tests[``] = metadata.MD{fieldPresenceMetaKey: nil}
tests[`{}`] = metadata.MD{fieldPresenceMetaKey: nil}
tests[`{`] = nil
tests[`{"one": {}}`] = metadata.MD{fieldPresenceMetaKey: []string{"One"}}
tests[`{"one":{"two":"a", "three":[]}, "four": 5}`] = metadata.MD{fieldPresenceMetaKey: []string{"Four$One.Two$One.Three"}}
tests[`{"objects":[{"one": {"two":"a", "three":[]}, "four": 5}, {"one":{"two":"a", "three":[]}, "four": 5}]}`] = metadata.MD{fieldPresenceMetaKey: []string{"Four$One.Two$One.Three", "Four$One.Two$One.Three"}}
tests[`{
"name": "atlas",
"burden": {
"duration": "forever",
Expand All @@ -42,8 +42,9 @@ func TestAnnotator(t *testing.T) {
"mortals": []
}
}
}`: {fieldPresenceMetaKey: []string{"Name$Burden.Duration$Burden.Weight$Burden.Breaks$Burden.Replacements.Hero.Name$Burden.Replacements.Hero.Duration$Burden.Replacements.Hero.Lineage.Mother$Burden.Replacements.Hero.Lineage.Father$Burden.Replacements.Mortals"}},
} {
}`] = metadata.MD{fieldPresenceMetaKey: []string{"Name$Burden.Duration$Burden.Weight$Burden.Breaks$Burden.Replacements.Hero.Name$Burden.Replacements.Hero.Duration$Burden.Replacements.Hero.Lineage.Mother$Burden.Replacements.Hero.Lineage.Father$Burden.Replacements.Mortals"}}

for input, expect := range tests {
postReq := &http.Request{
Method: "POST",
Body: ioutil.NopCloser(strings.NewReader(input)),
Expand Down

0 comments on commit ee168fa

Please sign in to comment.