Skip to content

Commit

Permalink
Merge branch 'master' into salticidae-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Apr 19, 2020
2 parents 765bffe + 117b1b9 commit e458ec6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion utils/logging/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
48 changes: 48 additions & 0 deletions vms/avm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}

0 comments on commit e458ec6

Please sign in to comment.