Skip to content

Commit

Permalink
Added new example for Trending languages
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrunwald committed Sep 10, 2015
1 parent d8dd61c commit f602687
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion trending_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func ExampleTrending_GetLanguages() {
log.Fatal(err)
}

if len(languages) > 0 {
// We need more as 15 languages, because 9 are trending languages
if len(languages) > 15 {
fmt.Println("Languages recieved.")
} else {
fmt.Printf("Number of languages recieved: %d", len(languages))
Expand All @@ -60,3 +61,19 @@ func ExampleTrending_GetDevelopers() {

// Output: Developers recieved.
}

func ExampleTrending_GetTrendingLanguages() {
trend := trending.NewTrending()
languages, err := trend.GetTrendingLanguages()
if err != nil {
log.Fatal(err)
}

if len(languages) > 0 {
fmt.Println("Trending Languages recieved.")
} else {
fmt.Printf("Number of languages recieved: %d", len(languages))
}

// Output: Trending Languages recieved.
}

0 comments on commit f602687

Please sign in to comment.