Compare commits

...

3 Commits

3 changed files with 6 additions and 23 deletions

View File

@ -125,12 +125,6 @@ func (h *MenuHandlers) Init(ctx context.Context, sym string, input []byte) (reso
h.st = h.pe.GetState() h.st = h.pe.GetState()
h.ca = h.pe.GetMemory() h.ca = h.pe.GetMemory()
if len(input) == 0 {
// move to the top node
h.st.Code = []byte{}
}
sessionId, ok := ctx.Value("SessionId").(string) sessionId, ok := ctx.Value("SessionId").(string)
if ok { if ok {
ctx = context.WithValue(ctx, "SessionId", sessionId) ctx = context.WithValue(ctx, "SessionId", sessionId)

View File

@ -175,20 +175,6 @@ func TestInit(t *testing.T) {
input: []byte("1"), input: []byte("1"),
expectedResult: resource.Result{}, 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 { for _, tt := range tests {

View File

@ -10,6 +10,7 @@ import (
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.grassecon.net/grassrootseconomics/sarafu-api/remote" "git.grassecon.net/grassrootseconomics/sarafu-api/remote"
sarafu_engine "git.grassecon.net/grassrootseconomics/sarafu-vise/engine"
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
) )
@ -24,7 +25,7 @@ type LocalHandlerService struct {
UserdataStore *db.Db UserdataStore *db.Db
Cfg engine.Config Cfg engine.Config
Rs resource.Resource 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) { 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 { 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 { if ls.first != nil {
en = en.WithFirst(ls.first) en = en.WithFirst(ls.first)
} }
@ -133,5 +135,6 @@ func (ls *LocalHandlerService) GetEngine(cfg engine.Config, rs resource.Resource
if cfg.EngineDebug { if cfg.EngineDebug {
en = en.WithDebug(nil) en = en.WithDebug(nil)
} }
return en
return se
} }