Ben Coman schreef op 31-3-2014 2:44:
Ben Coman wrote:
Roelof Wobben wrote:
Ben Coman schreef op 30-3-2014 20:12:
Roelof Wobben wrote:
Hello,

I trying to make the make you own method work.

So I first I added this :

testShout
  self assert: ('Don''t panic' shout = 'DON""T PANIC!')

After that I added this as described in the book.
shout
  ^  self asUppercase. "!"

But still the testrunner gives that there is a failing test on testShout.

Roelof



Rather than just feed you a fish, a little teaching how to fish :)
I would highlight and Inspect each side of the equals sign - so you can look at each string next to the other. Two things to think about:
* commas versus periods
* different types of quote marks
I'll follow up with the answer in the next post.
cheers -ben



Oke, I do not see it
I have now this : self assert: ('Dont panic!' shout = 'DONT PANIC!')
and for me it looks the same and still the test is failing.

and the other part has changed to  ^ self asUppercase, '!'

Roelof

This must be a little frustrating for you :) but like a lot of things its a matter a "getting your eye in". I hope you persist. You are almost there. You've made an additional change to the left hand side. I think if you again Inspect both sides of equals sign and compare the results it should become clear.

Now as an additional learning task, the other way to "fish" is to use the debugger. Highlight...
   'Dont panic!' shout
and from the context menu choose to Debug. Then step Into the #shout method. Once the debugger has moved into the #shout method, highlight and Inspect the following...
   self
   self asUppercase
   self asUppercase, '!'

The precise answer is my next post.
cheers -ben


You added an exclamation mark to the left hand side of the comparison that was not there before, so presuably the left hand side ends up as 'DONT PANIC!!' since the #shout method also appends an exclamation mark using the comma operator.
cheers -ben



Thanks for learning me how to fish.
You are right. I learn more this way then simply say where I went wrong.

Roelof


Reply via email to