mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/geth: improved TestAccountImport test
This commit is contained in:
parent
77385331ab
commit
62f238ecf0
1 changed files with 7 additions and 2 deletions
|
|
@ -89,18 +89,23 @@ Path of the secret key file: .*UTC--.+--[0-9a-f]{40}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccountImport(t *testing.T) {
|
func TestAccountImport(t *testing.T) {
|
||||||
tests := []struct{ key, output string }{
|
tests := []struct{ name, key, output string }{
|
||||||
{
|
{
|
||||||
|
name: "correct account",
|
||||||
key: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
|
key: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
|
||||||
output: "Address: {fcad0b19bb29d4674531d6f115237e16afce377c}\n",
|
output: "Address: {fcad0b19bb29d4674531d6f115237e16afce377c}\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: "invalid character",
|
||||||
key: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef1",
|
key: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef1",
|
||||||
output: "Fatal: Failed to load the private key: invalid character '1' at end of key file\n",
|
output: "Fatal: Failed to load the private key: invalid character '1' at end of key file\n",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
importAccountWithExpect(t, test.key, test.output)
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
importAccountWithExpect(t, test.key, test.output)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue