[Pharo-users] still failing test

Sergi Reyner sergi.reyner at gmail.com
Sun Mar 30 14:06:00 EDT 2014


2014-03-30 18:55 GMT+01:00 Roelof Wobben <r.wobben at home.nl>:

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

You properly doubled the single quote inside the first string. However, you
used two double quotes inside the second string; replace them with two
single quotes.

You also have an exclamation sign in the second string which is not in the
first one. Remove it and the test will pass. Note that the exclamation mark
in the following method is inside a comment:


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

This is fine. The ending period is not needed, though. Periods work as
statement separators in Smalltalk, not terminators as semicolons in C, for
example.


If you really want to have an exclamation mark added to the string, you
should implement shout as this:

shout
    ^ self asUppercase , '!'


Cheers,
Sergi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140330/b06c3842/attachment.html>


More information about the Pharo-users mailing list