Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/go/ssa: expected "Output:" text not instantiated for testing.InternalExample struct #12196

Open
elliott5 opened this Issue Aug 19, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@elliott5
Copy link

elliott5 commented Aug 19, 2015

go version go1.5rc1 darwin/amd64

For bonzo_test.go

package bonzo
import "fmt"
import _ "testing"
func ExampleHello() {
    fmt.Println("hello")
    // Output: hello
}

x/tools/go/ssa generates code:

function: test$main.main
block 0:
     t0 = new [1]testing.InternalExample (test main)
     t1 = &t0[0:int]
     t2 = &t1.Name [#0]
     *t2 = "ExampleHello":string
     t3 = &t1.F [#1]
     *t3 = github.com/tardisgo/tardisgo-samples/errors/exampletests/bonzo.ExampleHello
     t4 = slice t0[:]
     t5 = testing.Main(main$1, nil:[]testing.InternalTest, nil:[]testing.InternalBenchmark, t4)
     return

A program demonstrating this SSA code generation is at https://github.com/tardisgo/tardisgo-samples/tree/master/errors/exampletests

The Output field of structure testing.InternalExample is not being set to the text following "// Output:", which means that when the code runs (not currently possible in x/tools/go/ssa/interp) the output is:

Input: github.com/tardisgo/tardisgo-samples/errors/exampletests/bonzo
--- FAIL: ExampleHello (0.00s)
got:
hello
want:

FAIL
FAIL
The following tests failed:
    github.com/tardisgo/tardisgo-samples/errors/exampletests/bonzo

Rather than the test passing as expected:

PASS
ok      github.com/tardisgo/tardisgo-samples/errors/exampletests/bonzo  0.006s

@rsc rsc added this to the Unreleased milestone Oct 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.