Merge pull request #2810 from nspcc-dev/fix-loadgo

cli: split TestLoad into multiple parts
This commit is contained in:
Roman Khimov 2022-11-17 21:50:46 +07:00 committed by GitHub
commit 5d7b37a6ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -440,28 +440,38 @@ go 1.17`)
} }
` `
filename := prepareLoadgoSrc(t, srcCheckWitness) filename := prepareLoadgoSrc(t, srcCheckWitness)
e := newTestVMCLI(t) t.Run("address", func(t *testing.T) {
e.runProg(t, e := newTestVMCLI(t)
"loadgo "+filename+" "+ownerAddress, // owner:DefaultScope => true e.runProg(t,
"run main", "loadgo "+filename+" "+ownerAddress, // owner:DefaultScope => true
"loadgo "+filename+" "+ownerAddress+":None", // owner:None => false "run main",
"run main", "loadgo "+filename+" "+ownerAddress+":None", // owner:None => false
"loadgo "+filename+" "+ownerAcc.StringLE(), // ownerLE:DefaultScope => true "run main")
"run main", e.checkNextLine(t, "READY: loaded \\d+ instructions")
"loadgo "+filename+" 0x"+ownerAcc.StringLE(), // owner0xLE:DefaultScope => true e.checkStack(t, true)
"run main", e.checkNextLine(t, "READY: loaded \\d+ instructions")
"loadgo "+filename+" "+sideAcc.StringLE(), // sideLE:DefaultScope => false e.checkStack(t, false)
"run main") })
e.checkNextLine(t, "READY: loaded \\d+ instructions") t.Run("string LE", func(t *testing.T) {
e.checkStack(t, true) e := newTestVMCLI(t)
e.checkNextLine(t, "READY: loaded \\d+ instructions") e.runProg(t,
e.checkStack(t, false) "loadgo "+filename+" "+ownerAcc.StringLE(), // ownerLE:DefaultScope => true
e.checkNextLine(t, "READY: loaded \\d+ instructions") "run main",
e.checkStack(t, true) "loadgo "+filename+" 0x"+ownerAcc.StringLE(), // owner0xLE:DefaultScope => true
e.checkNextLine(t, "READY: loaded \\d+ instructions") "run main")
e.checkStack(t, true) e.checkNextLine(t, "READY: loaded \\d+ instructions")
e.checkNextLine(t, "READY: loaded \\d+ instructions") e.checkStack(t, true)
e.checkStack(t, false) e.checkNextLine(t, "READY: loaded \\d+ instructions")
e.checkStack(t, true)
})
t.Run("nonwitnessed signer", func(t *testing.T) {
e := newTestVMCLI(t)
e.runProg(t,
"loadgo "+filename+" "+sideAcc.StringLE(), // sideLE:DefaultScope => false
"run main")
e.checkNextLine(t, "READY: loaded \\d+ instructions")
e.checkStack(t, false)
})
}) })
t.Run("loadnef", func(t *testing.T) { t.Run("loadnef", func(t *testing.T) {
config.Version = "0.92.0-test" config.Version = "0.92.0-test"