Skip to content
Browse files

Use IsNil checker.

  • Loading branch information...
1 parent 11818cf commit 0ec7e0e2539bb75b259f78bac72bfa4944cc9fee @AlekSi committed Feb 17, 2013
Showing with 21 additions and 21 deletions.
  1. +6 −6 integration_test/local_test.go
  2. +4 −4 nut_test.go
  3. +5 −5 spec_test.go
  4. +6 −6 version_test.go
View
12 integration_test/local_test.go
@@ -29,7 +29,7 @@ func (*L) TestGenerateCheck(c *C) {
c.Check(stderr, Equals, "nut.json looks good.")
gitNoDiff(c, TestNut1)
- c.Check(os.Remove(TestNut2+"/nut.json"), Equals, nil)
+ c.Check(os.Remove(TestNut2+"/nut.json"), IsNil)
_, stderr = runNut(c, TestNut2, "generate -v")
expected := `
nut.json generated.
@@ -41,7 +41,7 @@ Now you should edit nut.json to fix following errors:
After that run 'nut check' to check spec again.`[1:]
c.Check(stderr, Equals, expected)
_, err := os.Stat(TestNut2 + "/nut.json")
- c.Check(err, Equals, nil)
+ c.Check(err, IsNil)
_, stderr = runNut(c, TestNut2, "check -v", 1)
expected = `
@@ -50,7 +50,7 @@ Found errors in nut.json:
"Crazy Nutter" is not a real person.`[1:]
c.Check(stderr, Equals, expected)
- c.Check(os.Remove(TestNut3+"/test_nut3.go"), Equals, nil)
+ c.Check(os.Remove(TestNut3+"/test_nut3.go"), IsNil)
_, stderr = runNut(c, TestNut3, "generate -v", 1)
c.Check(stderr, Equals, "no Go source files in .")
@@ -67,12 +67,12 @@ func (*L) TestPackCheckUnpack(c *C) {
c.Check(strings.HasSuffix(stderr, "test_nut1-0.0.1.nut looks good."), Equals, true)
gitNoDiff(c, TestNut1)
- c.Check(os.Remove(TestNut1+"/test_nut1.go"), Equals, nil)
+ c.Check(os.Remove(TestNut1+"/test_nut1.go"), IsNil)
_, stderr = runNut(c, TestNut1, "unpack -v test_nut1-0.0.1.nut")
c.Check(strings.HasSuffix(stderr, "test_nut1-0.0.1.nut unpacked."), Equals, true)
gitNoDiff(c, TestNut1)
- c.Check(os.Remove(TestNut2+"/nut.json"), Equals, nil)
+ c.Check(os.Remove(TestNut2+"/nut.json"), IsNil)
runNut(c, TestNut2, "generate -v")
_, stderr = runNut(c, TestNut2, "pack -v", 1)
c.Check(strings.HasPrefix(stderr, "Found errors:"), Equals, true)
@@ -82,7 +82,7 @@ func (*L) TestPackCheckUnpack(c *C) {
_, stderr = runNut(c, TestNut2, "check -v test_nut2-0.0.0.nut", 1)
c.Check(strings.HasPrefix(stderr, "Found errors in test_nut2-0.0.0.nut:"), Equals, true)
- c.Check(os.Remove(TestNut3+"/README"), Equals, nil)
+ c.Check(os.Remove(TestNut3+"/README"), IsNil)
_, stderr = runNut(c, TestNut3, "pack -nc -v", 1)
if runtime.GOOS == "windows" {
View
8 nut_test.go
@@ -21,21 +21,21 @@ var _ = Suite(&N{})
func (f *N) SetUpTest(c *C) {
file, err := os.Open("../test_nut1/test_nut1-0.0.1.nut")
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
f.f = file
b, err := ioutil.ReadAll(f.f)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
f.b = bytes.NewBuffer(b)
_, err = file.Seek(0, 0)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
}
func (f *N) TestNutFile(c *C) {
nf := new(NutFile)
_, err := nf.ReadFrom(f.f)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
c.Check(nf.Spec.Version.String(), Equals, "0.0.1")
c.Check(nf.Version.String(), Equals, "0.0.1")
View
10 spec_test.go
@@ -18,23 +18,23 @@ var _ = Suite(&S{})
func (f *S) SetUpTest(c *C) {
file, err := os.Open("../test_nut1/nut.json")
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
f.f = file
b, err := ioutil.ReadAll(f.f)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
f.b = bytes.NewBuffer(b)
_, err = file.Seek(0, 0)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
}
func (f *S) TestReadWrite(c *C) {
spec := new(Spec)
n, err := spec.ReadFrom(f.f)
c.Check(n, Equals, int64(f.b.Len()))
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
c.Check(spec.Version.String(), Equals, "0.0.1")
c.Check(len(spec.Authors), Equals, 1)
@@ -47,5 +47,5 @@ func (f *S) TestReadWrite(c *C) {
n2, err := spec.WriteTo(buf)
c.Check(n, Equals, n2)
c.Check(buf.String(), Equals, f.b.String())
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
}
View
12 version_test.go
@@ -44,16 +44,16 @@ func (f *V) TestNew(c *C) {
func (f *V) TestLess(c *C) {
for i, vi := range f.versions {
left, err := NewVersion(vi)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
for _, vj := range f.versions[:i] {
right, err := NewVersion(vj)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
c.Check(left.Less(right), Equals, false, Commentf("Expected %s >= %s", left, right))
}
for _, vj := range f.versions[i+1:] {
right, err := NewVersion(vj)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
c.Check(left.Less(right), Equals, true, Commentf("Expected %s < %s", left, right))
}
}
@@ -62,15 +62,15 @@ func (f *V) TestLess(c *C) {
func (f *V) TestJSON(c *C) {
for _, vs := range f.versions {
v, err := NewVersion(vs)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
b, err := json.Marshal(v)
c.Check(string(b), Equals, `"`+vs+`"`)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
v2 := new(Version)
err = json.Unmarshal(b, v2)
c.Check(v2, DeepEquals, v)
- c.Assert(err, Equals, nil)
+ c.Assert(err, IsNil)
}
}

0 comments on commit 0ec7e0e

Please sign in to comment.
Something went wrong with that request. Please try again.