Merge branch 'master' into salticidae-integration

This commit is contained in:
Stephen Buttolph 2020-04-19 19:06:12 -04:00 committed by GitHub
commit e458ec6934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 1 deletions

View File

@ -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)

View File

@ -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)
}
})
}
}