ReadWriteStream contents fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ReadWriteStream contents fails

niko.schwarz
Hi list,

http://code.google.com/p/pharo/issues/detail?id=2508&can=4&colspec=ID%20Type%20Status%20Summary%20Milestone%20Difficulty

The following mini unit test fails:

readWriteStreamShouldHonorStartIndex
    self assert: ( (ReadWriteStream on: 'hallo' from: 3 to: 4) contents = 'll')

Instead, contents returns 'hall'


Pharo image:core
Pharo core version: PharoCore1.1ALPHA, Latest update: #11383
Virtual machine used: pharo-vm-osx

Steps to reproduce:
1. Subclass TestCase and add the above method
2. run the test

Cheers,

Niko

--
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: ReadWriteStream contents fails

Henrik Sperre Johansen
On 05.06.2010 15:30, Niko Schwarz wrote:
Hi list,

http://code.google.com/p/pharo/issues/detail?id=2508&can=4&colspec=ID%20Type%20Status%20Summary%20Milestone%20Difficulty

The following mini unit test fails:

readWriteStreamShouldHonorStartIndex
    self assert: ( (ReadWriteStream on: 'hallo' from: 3 to: 4) contents = 'll')

Instead, contents returns 'hall'


Pharo image:core
Pharo core version: PharoCore1.1ALPHA, Latest update: #11383
Virtual machine used: pharo-vm-osx

Steps to reproduce:
1. Subclass TestCase and add the above method
2. run the test

Cheers,

Niko

Well, this is more an issue with contents, which returns the entire collection up to readLimit. (or position if it's a WriteStream)
From the ANSI standard:
"content returns a collection that contains the receiver's _past_ and future sequence values, in order".
The method which behaves as you expect, is called upToEnd.

Cheers, Henry

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: ReadWriteStream contents fails

niko.schwarz
I got confused about this because of what printString shows. At least
printString could show what is intended to be in the stream, not more.

Niko

2010/6/11 Henrik Sperre Johansen <[hidden email]>:

> On 05.06.2010 15:30, Niko Schwarz wrote:
>
> Hi list,
>
> http://code.google.com/p/pharo/issues/detail?id=2508&can=4&colspec=ID%20Type%20Status%20Summary%20Milestone%20Difficulty
>
> The following mini unit test fails:
>
> readWriteStreamShouldHonorStartIndex
>     self assert: ( (ReadWriteStream on: 'hallo' from: 3 to: 4) contents =
> 'll')
>
> Instead, contents returns 'hall'
>
>
> Pharo image:core
> Pharo core version: PharoCore1.1ALPHA, Latest update: #11383
> Virtual machine used: pharo-vm-osx
>
> Steps to reproduce:
> 1. Subclass TestCase and add the above method
> 2. run the test
>
> Cheers,
>
> Niko
>
> Well, this is more an issue with contents, which returns the entire
> collection up to readLimit. (or position if it's a WriteStream)
> From the ANSI standard:
> "content returns a collection that contains the receiver's _past_ and future
> sequence values, in order".
> The method which behaves as you expect, is called upToEnd.
>
> Cheers, Henry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project