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

2018-08-14 Thread zpsyhapcst
Wow!!, Thank you

I think test files do not work in "Play golang" , but it seems work fine

I learn a new trick again.

messju mohr於 2018年8月13日星期一 UTC+8下午10時52分43秒寫道:
>
> Here is a running version that shows the original poster's problem: 
>  
>
> On Mon, Aug 13, 2018 at 07:16:08AM -0700, gary.wi...@victoriaplumb.com 
>  wrote: 
> >Your program doesn't work. 
> > 
> >On Saturday, 11 August 2018 09:10:04 UTC+1, 子風 wrote: 
> > 
> >  Hi 
> >  [1]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 [2]golang-nuts...@googlegroups.com . 
> >For more options, visit [3]https://groups.google.com/d/optout. 
> > 
> > References 
> > 
> >Visible links 
> >1. https://play.golang.org/p/AIB-yJaExVu 
> >2. mailto:golang-nuts+unsubscr...@googlegroups.com  
> >3. 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] Re: Examples testing with two newline, but only one newline

2018-08-14 Thread zpsyhapcst
Thank you

I have written a test, but when I saw the Examples, I thought it was better 
to test my function.

And I got the error. I am not sure whether it is a bug.

Jake Montgomery於 2018年8月14日星期二 UTC+8上午5時27分46秒寫道:
>
> Looks like a bug to me. I would suggest you open an issue.
>
> It is not clear to me what the intended behavior is. It is documented that 
> examples strip some white space when comparing output. So it may be 
> intentional that multiple white space lines are removed from the expected 
> output. In that case, IMO, the bug is that the same transformation is not 
> applied to the output before comparing. Conversely, it is possible that the 
> removal of the blank lines is the bug. 
>
> That said, since examples are documented to "strip white space", I would 
> remind you to also write actual tests, if the white space of the results 
> matters to you. 
>
>
> On Saturday, August 11, 2018 at 4:10:04 AM UTC-4, 子風 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.


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

2018-08-13 Thread jake6502
Looks like a bug to me. I would suggest you open an issue.

It is not clear to me what the intended behavior is. It is documented that 
examples strip some white space when comparing output. So it may be 
intentional that multiple white space lines are removed from the expected 
output. In that case, IMO, the bug is that the same transformation is not 
applied to the output before comparing. Conversely, it is possible that the 
removal of the blank lines is the bug. 

That said, since examples are documented to "strip white space", I would 
remind you to also write actual tests, if the white space of the results 
matters to you. 


On Saturday, August 11, 2018 at 4:10:04 AM UTC-4, 子風 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.


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

2018-08-13 Thread messju mohr
Here is a running version that shows the original poster's problem:


On Mon, Aug 13, 2018 at 07:16:08AM -0700, gary.willoug...@victoriaplumb.com 
wrote:
>Your program doesn't work.
> 
>On Saturday, 11 August 2018 09:10:04 UTC+1, 子風 wrote:
> 
>  Hi
>  [1]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 [2]golang-nuts+unsubscr...@googlegroups.com.
>For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>Visible links
>1. https://play.golang.org/p/AIB-yJaExVu
>2. mailto:golang-nuts+unsubscr...@googlegroups.com
>3. 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] Re: Examples testing with two newline, but only one newline

2018-08-13 Thread gary . willoughby
Your program doesn't work.

On Saturday, 11 August 2018 09:10:04 UTC+1, 子風 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.