Skip to content

Commit

Permalink
tests: golint fixes for tests directory (ethereum#16640)
Browse files Browse the repository at this point in the history
  • Loading branch information
roveneliah authored and kimmyeonghun committed Jul 3, 2018
1 parent 7cc40f7 commit ea9d152
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/block_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (t *BlockTest) Run() error {
return err
}
if gblock.Hash() != t.json.Genesis.Hash {
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x\n", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
return fmt.Errorf("genesis block hash doesn't match test: computed=%x, test=%x", gblock.Hash().Bytes()[:6], t.json.Genesis.Hash[:6])
}
if gblock.Root() != t.json.Genesis.StateRoot {
return fmt.Errorf("genesis block state root does not match test: computed=%x, test=%x", gblock.Root().Bytes()[:6], t.json.Genesis.StateRoot[:6])
Expand Down
2 changes: 1 addition & 1 deletion tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/ethersocial/go-esn/params"
)

// This table defines supported forks and their chain config.
// Forks table defines supported forks and their chain config.
var Forks = map[string]*params.ChainConfig{
"Frontier": {
ChainId: big.NewInt(1),
Expand Down
11 changes: 5 additions & 6 deletions tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
)

func readJson(reader io.Reader, value interface{}) error {
func readJSON(reader io.Reader, value interface{}) error {
data, err := ioutil.ReadAll(reader)
if err != nil {
return fmt.Errorf("error reading JSON file: %v", err)
Expand All @@ -57,14 +57,14 @@ func readJson(reader io.Reader, value interface{}) error {
return nil
}

func readJsonFile(fn string, value interface{}) error {
func readJSONFile(fn string, value interface{}) error {
file, err := os.Open(fn)
if err != nil {
return err
}
defer file.Close()

err = readJson(file, value)
err = readJSON(file, value)
if err != nil {
return fmt.Errorf("%s in file %s", err.Error(), fn)
}
Expand Down Expand Up @@ -169,9 +169,8 @@ func (tm *testMatcher) checkFailure(t *testing.T, name string, err error) error
if err != nil {
t.Logf("error: %v", err)
return nil
} else {
return fmt.Errorf("test succeeded unexpectedly")
}
return fmt.Errorf("test succeeded unexpectedly")
}
return err
}
Expand Down Expand Up @@ -213,7 +212,7 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte

// Load the file as map[string]<testType>.
m := makeMapFromTestFunc(runTest)
if err := readJsonFile(path, m.Addr().Interface()); err != nil {
if err := readJSONFile(path, m.Addr().Interface()); err != nil {
t.Fatal(err)
}

Expand Down
3 changes: 1 addition & 2 deletions tests/transaction_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ func (tt *TransactionTest) Run(config *params.ChainConfig) error {
if err := rlp.DecodeBytes(tt.json.RLP, tx); err != nil {
if tt.json.Transaction == nil {
return nil
} else {
return fmt.Errorf("RLP decoding failed: %v", err)
}
return fmt.Errorf("RLP decoding failed: %v", err)
}
// Check sender derivation.
signer := types.MakeSigner(config, new(big.Int).SetUint64(uint64(tt.json.BlockNumber)))
Expand Down

0 comments on commit ea9d152

Please sign in to comment.