[BUG] parse error in complex heredocs

A

Alexander Kellett

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


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

tia,
alex
 
T

ts

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
 
A

Alexander Kellett

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 :(

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
 
N

Navindra Umanee

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 said:
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 :(

"A" == Alexander Kellett <[email protected]> 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top