UpdatedPharoByExample icon indicating copy to clipboard operation
UpdatedPharoByExample copied to clipboard

Example in 2.13 for testShout - text does not match figure

Open swilliamson24060 opened this issue 7 years ago • 6 comments

The text says: We can turn our ”NoPanic” code example into the test method itself:

    testShout
        self assert: ('No panic' shout = 'NO PANIC!')

However, the figure shows:

    testShout
        self assert: 'No panic' shout = 'NO PANIC!'

The text also is confusing, or incomplete. It states that the Code Checker will inform you that the message is not implemented. It actually gives you two errors. The first is Use assert: equals: instead of assert: and =

So for the reader, should they accept this change?

swilliamson24060 avatar May 09 '17 14:05 swilliamson24060

Tx for the report. Yes this is the same.

Ducasse avatar May 09 '17 15:05 Ducasse

assert:= and assert:equal: do the same

Ducasse avatar May 09 '17 15:05 Ducasse

What about the parens? Do they belong or should they be omitted?

swilliamson24060 avatar May 09 '17 15:05 swilliamson24060

The parenthesis in this example do not change anything. Because keyword: (assert:) message takes precedence over binary (=)

Ducasse avatar May 09 '17 18:05 Ducasse

That doesn't sound right. Otherwise... Transcript show: 1 = 2 would output "1" instead of "false",

bencoman avatar May 10 '17 09:05 bencoman

Stef mistyped :) Precedence is still (in decreasing order) parentheses then unary then binary then keyword messages then left-to-right.

cdlm avatar May 10 '17 10:05 cdlm