Skip to content
Browse files

Simplify tests.

  • Loading branch information...
1 parent c4e68e3 commit 7c5f75dd0a6386c8f25adbe9e2ed020477c80b3f @AlekSi committed
Showing with 7 additions and 10 deletions.
  1. +6 −9 nut_test.go
  2. +1 −1 spec_test.go
View
15 nut_test.go
@@ -1,9 +1,7 @@
package nut_test
import (
- "bytes"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -14,7 +12,7 @@ import (
type N struct {
f *os.File
- b *bytes.Buffer
+ l int64
}
var _ = Suite(&N{})
@@ -24,18 +22,17 @@ func (f *N) SetUpTest(c *C) {
c.Assert(err, IsNil)
f.f = file
- b, err := ioutil.ReadAll(f.f)
- c.Assert(err, IsNil)
- f.b = bytes.NewBuffer(b)
-
- _, err = file.Seek(0, 0)
+ fi, err := f.f.Stat()
c.Assert(err, IsNil)
+ f.l = fi.Size()
}
func (f *N) TestNutFile(c *C) {
nf := new(NutFile)
- _, err := nf.ReadFrom(f.f)
+
+ n, err := nf.ReadFrom(f.f)
c.Assert(err, IsNil)
+ c.Check(n, Equals, f.l)
c.Check(nf.Spec.Version.String(), Equals, "0.0.1")
c.Check(nf.Version.String(), Equals, "0.0.1")
View
2 spec_test.go
@@ -25,7 +25,7 @@ func (f *S) SetUpTest(c *C) {
c.Assert(err, IsNil)
f.b = bytes.NewBuffer(b)
- _, err = file.Seek(0, 0)
+ _, err = f.f.Seek(0, 0)
c.Assert(err, IsNil)
}

0 comments on commit 7c5f75d

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