mirror of https://github.com/poanetwork/gecko.git
Merge branch 'master' into salticidae-integration
This commit is contained in:
commit
e458ec6934
|
@ -43,7 +43,7 @@ func (f *factory) Make() (Logger, error) {
|
|||
// MakeChain ...
|
||||
func (f *factory) MakeChain(chainID ids.ID, subdir string) (Logger, error) {
|
||||
config := f.config
|
||||
config.MsgPrefix = "SN " + chainID.String()
|
||||
config.MsgPrefix = "chain " + chainID.String()
|
||||
config.Directory = path.Join(config.Directory, "chain", chainID.String(), subdir)
|
||||
|
||||
log, err := New(config)
|
||||
|
|
|
@ -934,3 +934,51 @@ func TestIssueProperty(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVMFormat(t *testing.T) {
|
||||
_, _, vm := GenesisVM(t)
|
||||
defer ctx.Lock.Unlock()
|
||||
defer vm.Shutdown()
|
||||
|
||||
tests := []struct {
|
||||
in string
|
||||
expected string
|
||||
}{
|
||||
{"", "3D7sudhzUKTYFkYj4Zoe7GgSKhuyP9bYwXunHwhZsmQe1z9Mp-45PJLL"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.in, func(t *testing.T) {
|
||||
if res := vm.Format([]byte(tt.in)); tt.expected != res {
|
||||
t.Errorf("Expected %q, got %q", tt.expected, res)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestVMFormatAliased(t *testing.T) {
|
||||
_, _, vm := GenesisVM(t)
|
||||
defer ctx.Lock.Unlock()
|
||||
defer vm.Shutdown()
|
||||
|
||||
origAliases := ctx.BCLookup
|
||||
defer func() { ctx.BCLookup = origAliases }()
|
||||
|
||||
tmpAliases := &ids.Aliaser{}
|
||||
tmpAliases.Initialize()
|
||||
tmpAliases.Alias(ctx.ChainID, "X")
|
||||
ctx.BCLookup = tmpAliases
|
||||
|
||||
tests := []struct {
|
||||
in string
|
||||
expected string
|
||||
}{
|
||||
{"", "X-45PJLL"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.in, func(t *testing.T) {
|
||||
if res := vm.Format([]byte(tt.in)); tt.expected != res {
|
||||
t.Errorf("Expected %q, got %q", tt.expected, res)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue