you are using the testing framework incorrectly- 
https://golang.org/pkg/testing/

your function is incompatible with the test harness. The function signature 
must follow a few rules.

Your test file does not have any functions matching the required signature.

What you are doing is running an example. The test harness ran your 
function with no problems so you got no output.

// This Example function fails in the test harness as the fmt.Println 
output does not match the expected output conveyed within the Output tag. 
The test harness throws a fit.
func ExampleMethod1 ( ) {
 fmt.Println("hi")
// Output: hello
}

// This Example function passes in the test harness as the fmt.Println 
output does match the expected output conveyed within the Output tag. The 
test harness is silent.
func ExampleMethod1 ( ) {
 fmt.Println("hi")
// Output: hi
}



On Monday, September 12, 2016 at 7:46:24 PM UTC-4, Harry wrote:
>
> Hi there,
>
> I'm trying to run example in test.
> However after running, warning is shown.
> ```
> testing: warning: no tests to run
> ```
>
> This example code include // Output comment.
>
> ```
> func ExampleMethod1() {
> fmt.Printf("result: %x", Method1())
> // Output: xxxx
> }
> ```
>
> What is wrong? When running test, I exec like this.
>
> ```go test -v xxxx_test.go```
>
>
> Thanks.
>
> Harry
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to