[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[BUG] parse error in complex heredocs

Alexander Kellett

2/17/2005 6:01:00 PM

check <<-ENDTEST, [:blah
blah blah blah
ENDTEST
=>
[5]
]


-> is there any sane reason this doesn't work?

tia,
alex



4 Answers

ts

2/17/2005 6:07:00 PM

0

>>>>> "A" == Alexander Kellett <ruby-lists@lypanov.net> writes:

A> check <<-ENDTEST, [:blah
A> blah blah blah
A> ENDTEST

You have written this

check 'blah blah blah', [:blah

i.e.

check('blah blah blah', [:blah)


Guy Decoux







Alexander Kellett

2/17/2005 6:11:00 PM

0

oops there goes 'prerelease test testing'
i meant {} of course :)

On Feb 17, 2005, at 7:00 PM, Alexander Kellett wrote:
> check <<-ENDTEST, [:blah
> blah blah blah
> ENDTEST
> =>
> [5]
> ]
>
>
> -> is there any sane reason this doesn't work?
>
> tia,
> alex



Alexander Kellett

2/17/2005 6:14:00 PM

0

i had assumed that the fact that it was a hash (my mail had mistake -
'{' instead of '[' )
would make it wait for the =>
but was incorrect - testcase:
irb(main):001:0> {5
irb(main):002:1> => 6}
SyntaxError: compile error
(irb):1: odd number list for Hash
(irb):2: parse error
=> 6}
^

if this could work my test cases could look pretty :)
maybe i could use "# => " instead... but not as nice :(

On Feb 17, 2005, at 7:06 PM, ts wrote:
>>>>>> "A" == Alexander Kellett <ruby-lists@lypanov.net> writes:
>
> A> check <<-ENDTEST, [:blah
> A> blah blah blah
> A> ENDTEST
>
> You have written this
>
> check 'blah blah blah', [:blah
>
> i.e.
>
> check('blah blah blah', [:blah)
>
>
> Guy Decoux
>
>
>
>
>



Navindra Umanee

2/17/2005 6:23:00 PM

0


The same thing happens if you try to put an array comma on the next
line.

irb(main):035:0> [5
irb(main):036:1> ,
irb(main):037:1* 4]
SyntaxError: compile error
(irb):36: syntax error
from (irb):37

See, whitespace has meaning in Ruby too. What a joke!! :-)

Cheers,
Navin.

Alexander Kellett <ruby-lists@lypanov.net> wrote:
> i had assumed that the fact that it was a hash (my mail had mistake -
> '{' instead of '[' )
> would make it wait for the =>
> but was incorrect - testcase:
> irb(main):001:0> {5
> irb(main):002:1> => 6}
> SyntaxError: compile error
> (irb):1: odd number list for Hash
> (irb):2: parse error
> => 6}
> ^
>
> if this could work my test cases could look pretty :)
> maybe i could use "# => " instead... but not as nice :(
>
> On Feb 17, 2005, at 7:06 PM, ts wrote:
> >>>>>> "A" == Alexander Kellett <ruby-lists@lypanov.net> writes:
> >
> > A> check <<-ENDTEST, [:blah
> > A> blah blah blah
> > A> ENDTEST
> >
> > You have written this
> >
> > check 'blah blah blah', [:blah
> >
> > i.e.
> >
> > check('blah blah blah', [:blah)
> >
> >
> > Guy Decoux
> >
> >
> >
> >
> >
>