Merge pull request #3 from cgomezmendez/master

refactored testing to use go Testing library
This commit is contained in:
Christopher Herrera 2015-06-26 13:33:02 -04:00
commit 2d78fe6fbf

View file

@ -17,32 +17,33 @@ limitations under the License.
package main package main
import ( import (
"fmt"
imdb "github.com/eefret/go-imdb" imdb "github.com/eefret/go-imdb"
"log" "testing"
) )
func main() { func TestMovieSearch(t *testing.T) {
//Testing SearchMovies //Testing SearchMovies
res, err := imdb.SearchMovies("The fifth element", "") res, err := imdb.SearchMovies("The fifth element", "")
if err != nil { if err != nil {
log.Fatal(err) t.Error(err)
} }
t.Log(res.Search[0].Title)
}
func TestGetMovieByTitle(t *testing.T) {
//Testing GetMovieByTitle //Testing GetMovieByTitle
res2, err := imdb.GetMovieByTitle("True Grit", "1969") res2, err := imdb.GetMovieByTitle("True Grit", "1969")
if err != nil { if err != nil {
log.Fatal(err) t.Error(err)
} }
t.Log(res2.Title)
//Testing GetMovieByImdbId }
res3, err := imdb.GetMovieByImdbId("tt2015381")
if err != nil { func TestGetMovieByImdbId(t *testing.T) {
log.Fatal(err) //Testing GetMovieByImdbId
} res3, err := imdb.GetMovieByImdbID("tt2015381")
if err != nil {
fmt.Println(res.Search[0].Title) t.Error(err)
fmt.Println(res2.Title) }
fmt.Println(res3.Title) t.Log(res3.Title)
} }