Compiler test now holds output from compiler until end
This commit is contained in:
parent
9459f6192b
commit
e87717ac21
@ -1,6 +1,5 @@
|
||||
package compiler
|
||||
|
||||
import "os"
|
||||
import "io/fs"
|
||||
import "embed"
|
||||
import "strings"
|
||||
@ -25,8 +24,12 @@ func testUnit (
|
||||
temp := test.TempDir()
|
||||
|
||||
// instantiate and configure the compiler
|
||||
compOutputBuilder := new(strings.Builder)
|
||||
defer func () {
|
||||
test.Log("compiler log:\n" + compOutputBuilder.String())
|
||||
} ()
|
||||
comp := new(Compiler)
|
||||
comp.Writer = os.Stderr
|
||||
comp.Writer = compOutputBuilder
|
||||
comp.Resolver = NewResolver (
|
||||
"/usr/local/src/fspl",
|
||||
"/usr/src/fspl",
|
||||
@ -51,8 +54,8 @@ func testUnit (
|
||||
comp.Output,
|
||||
"-o",
|
||||
executablePath)...)
|
||||
linkCommand.Stdout = os.Stderr
|
||||
linkCommand.Stderr = os.Stderr
|
||||
linkCommand.Stdout = compOutputBuilder
|
||||
linkCommand.Stderr = compOutputBuilder
|
||||
test.Log("running link command: ", linkCommand)
|
||||
err = linkCommand.Run()
|
||||
if err != nil {
|
||||
@ -105,7 +108,6 @@ func TestEmbedOk (test *testing.T) {
|
||||
func TestHelloWorld (test *testing.T) {
|
||||
testUnit (test,
|
||||
"/test-data/data/hello", nil,
|
||||
"",
|
||||
"Hello, world!\n",
|
||||
"", "Hello, world!\n",
|
||||
0,
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user