Merge pull request #1602 from nspcc-dev/fix/test

vmcli/test: run shell after providing input
This commit is contained in:
Roman Khimov 2020-12-10 14:42:30 +03:00 committed by GitHub
commit f3e64e08d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -61,13 +61,13 @@ func TestCompiler(t *testing.T) {
require.NoError(t, err)
err = os.MkdirAll(exampleSavePath, os.ModePerm)
require.NoError(t, err)
outfile := exampleSavePath + "/test.nef"
_, err = compiler.CompileAndSave(exampleCompilePath+"/"+infos[0].Name(), &compiler.Options{Outfile: outfile})
require.NoError(t, err)
defer func() {
err := os.RemoveAll(exampleSavePath)
require.NoError(t, err)
}()
outfile := exampleSavePath + "/test.nef"
_, err = compiler.CompileAndSave(exampleCompilePath+"/"+infos[0].Name(), &compiler.Options{Outfile: outfile})
require.NoError(t, err)
},
},
}

View file

@ -75,16 +75,16 @@ func newTestVMCLIWithLogo(t *testing.T, printLogo bool) *executor {
Stdin: e.in,
Stdout: e.out,
})
go func() {
require.NoError(t, e.cli.Run())
close(e.ch)
}()
return e
}
func (e *executor) runProg(t *testing.T, commands ...string) {
cmd := strings.Join(commands, "\n") + "\n"
e.in.WriteString(cmd + "\n")
go func() {
require.NoError(t, e.cli.Run())
close(e.ch)
}()
select {
case <-e.ch:
case <-time.After(time.Second):