[squeak-dev] TestRunner not assigning strings/remembering old values of temp vars.

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sun Jul 25 07:51:17 UTC 2010


Of course, 'squeaker' is a literal stored in the CompiledMethod.
If you write over it, then you break the literal for next method execution.

Each time you evaluate in a workspace, you create a new CompiledMethod
and a new literal.
When you compile in a class, that's different because you compiled
only once and execute many.

Nicolas

2010/7/25 Rob Withers <reefedjib at yahoo.com>:
> I am testing the CryptoDESTest.  I am getting some strange behavior.  When I
> run the following code in a Workspace, repeatably, I get the same results:
>
> code:
>
>        | plain key d |
>        plain := 'squeaker'.
>        key := 'hacking!'.
>        Transcript cr; show: 'plain: ', plain printString.
>        d := DES key: key.
>        d encryptBlock: plain.
>        Transcript cr; show: 'plain: ', plain printString.
>        self assert: plain asByteArray = #[64 222 70 13 59 145 76 186].
>        plain destroy.
>
> output:
>
> plain: 'squeaker'
> plain: '@ÞF
> ;‘Lº'
> plain: 'squeaker'
> plain: '@ÞF
> ;‘Lº'
> plain: 'squeaker'
> plain: '@ÞF
> ;‘Lº'
>
> However, when I run this as a test method:
>
> testDES3
>        | plain key d |
>        plain := 'squeaker'.
>        key := 'hacking!'.
>        Transcript cr; show: 'plain: ', plain printString.
>        d := DES key: key.
>        d encryptBlock: plain.
>        Transcript cr; show: 'plain: ', plain printString.
>        self assert: plain asByteArray = #[64 222 70 13 59 145 76 186].
>               plain destroy.
>
> I get the following output and the test fails:
>
> plain: 'squeaker'
> plain: '@ÞF
> ;‘Lº'
> plain: '        '
> plain: '£ƒ¼ïùmÞ$'
> plain: '£ƒ¼ïùmÞ$'
> plain: '§,}ºé¨öú'
> plain: '§,}ºé¨öú'
> plain: '3qX¦wRË|'
> plain: '3qX¦wRË|'
> plain: 'Ê0ê^ó{ì '
> plain: 'Ê0ê^ó{ì '
> plain: 'çî³›,ίw'
>
> Why is test runner remembering the old value and not setting it with: plain
> := 'squeaker'.?
>
> TIA,
> Rob
>
>



More information about the Squeak-dev mailing list