Skip to content

Commit

Permalink
Merge pull request #57 from sprak3000/issue-55-check-unmarshal-errs
Browse files Browse the repository at this point in the history
Issue #55 - Add error checking to JSON unmarshals
  • Loading branch information
Henry Sarabia authored Nov 13, 2019
2 parents 1041881 + ec5455e commit 1196f3f
Show file tree
Hide file tree
Showing 64 changed files with 775 additions and 196 deletions.
15 changes: 12 additions & 3 deletions achievement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestAchievementService_Get(t *testing.T) {
}

init := make([]*Achievement, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestAchievementService_List(t *testing.T) {
}

init := make([]*Achievement, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestAchievementService_Index(t *testing.T) {
}

init := make([]*Achievement, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions achievementicon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestAchievementIconService_Get(t *testing.T) {
}

init := make([]*AchievementIcon, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestAchievementIconService_List(t *testing.T) {
}

init := make([]*AchievementIcon, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestAchievementIconService_Index(t *testing.T) {
}

init := make([]*AchievementIcon, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions agerating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestAgeRatingService_Get(t *testing.T) {
}

init := make([]*AgeRating, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestAgeRatingService_List(t *testing.T) {
}

init := make([]*AgeRating, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestAgeRatingService_Index(t *testing.T) {
}

init := make([]*AgeRating, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions ageratingcontent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestAgeRatingContentService_Get(t *testing.T) {
}

init := make([]*AgeRatingContent, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestAgeRatingContentService_List(t *testing.T) {
}

init := make([]*AgeRatingContent, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestAgeRatingContentService_Index(t *testing.T) {
}

init := make([]*AgeRatingContent, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions alternativename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestAlternativeNameService_Get(t *testing.T) {
}

init := make([]*AlternativeName, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestAlternativeNameService_List(t *testing.T) {
}

init := make([]*AlternativeName, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestAlternativeNameService_Index(t *testing.T) {
}

init := make([]*AlternativeName, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions artwork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestArtworkService_Get(t *testing.T) {
}

init := make([]*Artwork, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestArtworkService_List(t *testing.T) {
}

init := make([]*Artwork, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestArtworkService_Index(t *testing.T) {
}

init := make([]*Artwork, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
20 changes: 16 additions & 4 deletions character_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ func TestCharacterService_Get(t *testing.T) {
}

init := make([]*Character, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -65,7 +68,10 @@ func TestCharacterService_List(t *testing.T) {
}

init := make([]*Character, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -109,7 +115,10 @@ func TestCharacterService_Index(t *testing.T) {
}

init := make([]*Character, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down Expand Up @@ -150,7 +159,10 @@ func TestCharacterService_Search(t *testing.T) {
}

init := make([]*Character, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions charactermugshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestCharacterMugshotService_Get(t *testing.T) {
}

init := make([]*CharacterMugshot, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestCharacterMugshotService_List(t *testing.T) {
}

init := make([]*CharacterMugshot, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestCharacterMugshotService_Index(t *testing.T) {
}

init := make([]*CharacterMugshot, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
20 changes: 16 additions & 4 deletions collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ func TestCollectionService_Get(t *testing.T) {
}

init := make([]*Collection, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -65,7 +68,10 @@ func TestCollectionService_List(t *testing.T) {
}

init := make([]*Collection, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -109,7 +115,10 @@ func TestCollectionService_Index(t *testing.T) {
}

init := make([]*Collection, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down Expand Up @@ -150,7 +159,10 @@ func TestCollectionService_Search(t *testing.T) {
}

init := make([]*Collection, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down
15 changes: 12 additions & 3 deletions company_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func TestCompanyService_Get(t *testing.T) {
}

init := make([]*Company, 1)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -64,7 +67,10 @@ func TestCompanyService_List(t *testing.T) {
}

init := make([]*Company, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

var tests = []struct {
name string
Expand Down Expand Up @@ -108,7 +114,10 @@ func TestCompanyService_Index(t *testing.T) {
}

init := make([]*Company, 0)
json.Unmarshal(f, &init)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}

tests := []struct {
name string
Expand Down
Loading

0 comments on commit 1196f3f

Please sign in to comment.