Skip to content

Commit 344edd5

Browse files
committed
Add very basic test
1 parent fcc7856 commit 344edd5

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: go
2+
before_install:
3+
- sudo apt-get install libgeoip-dev bzr
4+
install:
5+
- go get launchpad.net/gocheck
6+
- go get -v
7+
- go build -v
8+
- go install

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (C) 2012 Stiletto <[email protected]>
2-
Copyright (C) 2012 Ask Bjørn Hansen, Develooper LLC
2+
Copyright (C) 2012-2013 Ask Bjørn Hansen, Develooper LLC
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of
55
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Country](http://www.maxmind.com/app/geoip_country) database or you can
2525
country := gi.GetCountry("207.171.7.51")
2626
}
2727

28-
// Setup gi6 by opening the optional IPv6 database and then:
28+
// Setup gi6 by opening the optional IPv6 database and then:
2929
country := gi6.GetCountry_v6("2607:f238:2::5")
30-
display(country)
30+
fmt.Println(country)
3131

3232

3333
## Contact

geoip_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package geoip
2+
3+
import (
4+
"fmt"
5+
. "launchpad.net/gocheck"
6+
"testing"
7+
)
8+
9+
// Hook up gocheck into the gotest runner.
10+
func Test(t *testing.T) { TestingT(t) }
11+
12+
type GeoIPSuite struct {
13+
}
14+
15+
var _ = Suite(&GeoIPSuite{})
16+
17+
func (s *GeoIPSuite) Testv4(c *C) {
18+
gi := Open()
19+
if gi == nil {
20+
fmt.Printf("Could not open GeoIP database\n")
21+
}
22+
23+
c.Check(gi, NotNil)
24+
25+
country := gi.GetCountry("207.171.7.51")
26+
c.Check(country, Equals, "US")
27+
}

0 commit comments

Comments
 (0)