Re: [go-nuts] Examples testing with two newline, but only one newline

2018-08-13 Thread Shane
Hmm I meant to reply to the group but I think I inadvertantly replied
directly (my apologies).

I'll repost my answer because I think that it may help others with the same
issue (the multi line examples!)

Hi

There are two ways to use examples with multi line outputs

1) Multi line comments (Be aware that whitespace may become an issue)

/* Output: Line1
Line 2
*/


2) Multiple single line comments (my preference)

// Output: Line1
// Line 2

HTH

On Sat, Aug 11, 2018 at 6:09 PM,  wrote:

> Hi
>
> https://play.golang.org/p/AIB-yJaExVu
>
> When I want to use examples to test my code, I find something odd.
> Example1 could pass, but Example2 failed
>
> --- FAIL: Example2 (0.00s)
>> got:
>> hello
>> .
>>
>> 123
>> want:
>> hello
>> .
>> 123
>> FAIL
>> exit status 1
>
>
> It seems Examples could only show one newline.
> Is there a solution to solve it? Thanks
>
> --
> 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.
>

-- 
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.


[go-nuts] Examples testing with two newline, but only one newline

2018-08-11 Thread zpsyhapcst
Hi

https://play.golang.org/p/AIB-yJaExVu

When I want to use examples to test my code, I find something odd.
Example1 could pass, but Example2 failed

--- FAIL: Example2 (0.00s)
> got:
> hello
> .
>
> 123
> want:
> hello
> .
> 123
> FAIL
> exit status 1


It seems Examples could only show one newline.
Is there a solution to solve it? Thanks

-- 
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.