Compare commits
3 Commits
fdde1bb979
...
68597ea7cc
Author | SHA1 | Date | |
---|---|---|---|
68597ea7cc | |||
3d9eeddab8 | |||
df58f69032 |
@ -125,12 +125,6 @@ func (h *MenuHandlers) Init(ctx context.Context, sym string, input []byte) (reso
|
||||
|
||||
h.st = h.pe.GetState()
|
||||
h.ca = h.pe.GetMemory()
|
||||
|
||||
if len(input) == 0 {
|
||||
// move to the top node
|
||||
h.st.Code = []byte{}
|
||||
}
|
||||
|
||||
sessionId, ok := ctx.Value("SessionId").(string)
|
||||
if ok {
|
||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
||||
|
@ -175,20 +175,6 @@ func TestInit(t *testing.T) {
|
||||
input: []byte("1"),
|
||||
expectedResult: resource.Result{},
|
||||
},
|
||||
{
|
||||
name: "Move to top node on empty input",
|
||||
setup: func() (*MenuHandlers, context.Context) {
|
||||
pe := persist.NewPersister(testStore).WithSession(sessionId).WithContent(st, ca)
|
||||
h := &MenuHandlers{
|
||||
flagManager: fm,
|
||||
pe: pe,
|
||||
}
|
||||
st.Code = []byte("some pending bytecode")
|
||||
return h, context.WithValue(ctx, "SessionId", sessionId)
|
||||
},
|
||||
input: []byte(""),
|
||||
expectedResult: resource.Result{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"git.defalsify.org/vise.git/resource"
|
||||
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||
sarafu_engine "git.grassecon.net/grassrootseconomics/sarafu-vise/engine"
|
||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
||||
)
|
||||
|
||||
@ -24,7 +25,7 @@ type LocalHandlerService struct {
|
||||
UserdataStore *db.Db
|
||||
Cfg engine.Config
|
||||
Rs resource.Resource
|
||||
first resource.EntryFunc
|
||||
first resource.EntryFunc
|
||||
}
|
||||
|
||||
func NewLocalHandlerService(ctx context.Context, fp string, debug bool, dbResource *resource.DbResource, cfg engine.Config, rs resource.Resource) (*LocalHandlerService, error) {
|
||||
@ -125,7 +126,8 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
|
||||
}
|
||||
|
||||
func (ls *LocalHandlerService) GetEngine(cfg engine.Config, rs resource.Resource, pr *persist.Persister) engine.Engine {
|
||||
en := engine.NewEngine(cfg, rs)
|
||||
se := sarafu_engine.NewSarafuEngine(cfg, rs)
|
||||
en := se.Engine.(*engine.DefaultEngine)
|
||||
if ls.first != nil {
|
||||
en = en.WithFirst(ls.first)
|
||||
}
|
||||
@ -133,5 +135,6 @@ func (ls *LocalHandlerService) GetEngine(cfg engine.Config, rs resource.Resource
|
||||
if cfg.EngineDebug {
|
||||
en = en.WithDebug(nil)
|
||||
}
|
||||
return en
|
||||
|
||||
return se
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user