Investigating MultiByteFileStream for adding tests
Hi, I've been looking into MultiByteFileStream for adding tests in this area, and have come up against what appears to me to be an anomaly. I ran the following 4 tests: FileStream fileNamed: 'test.txt' do: [ :str | str nextPutAll: '123'; crlf ]. MultiByteFileStream fileNamed: 'test2.txt' do: [ :str | str nextPutAll: '123'; crlf ]. FileStream fileNamed: 'test3.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ]. MultiByteFileStream fileNamed: 'test4.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ]. The results are: Input string Result Unix File Class Class Type --------------------------------------------------------------- FileStream '123' MultiByte- ASCII text FileStream MultiByte- '123' MultiByte- ASCII text FileStream FileStream FileStream 'élève en MultiByte- UTF-8 Unicode Français' FileStream MultiByte- 'élève en MultiByte- UTF-8 Unicode FileStream Français' FileStream Do operations involving FileStream as input always return a MultiByteFileStream? Thanks, Sheridan
On 08 Dec 2014, at 22:27, sheridan@sheridan-mahoney.com wrote:
Hi, I've been looking into MultiByteFileStream for adding tests in this area, and have come up against what appears to me to be an anomaly. I ran the following 4 tests:
FileStream fileNamed: 'test.txt' do: [ :str | str nextPutAll: '123'; crlf ].
MultiByteFileStream fileNamed: 'test2.txt' do: [ :str | str nextPutAll: '123'; crlf ].
FileStream fileNamed: 'test3.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ].
MultiByteFileStream fileNamed: 'test4.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ].
The results are:
Input string Result Unix File Class Class Type --------------------------------------------------------------- FileStream '123' MultiByte- ASCII text FileStream
MultiByte- '123' MultiByte- ASCII text FileStream FileStream
FileStream 'élève en MultiByte- UTF-8 Unicode Français' FileStream
MultiByte- 'élève en MultiByte- UTF-8 Unicode FileStream Français' FileStream
Do operations involving FileStream as input always return a MultiByteFileStream?
Yes. They also use UTF-8 by default (ASCII is a proper subset of UTF-8).
Thanks, Sheridan
We are interested in improving test coverage of Pharo so thanks for your initiative. Le 8/12/14 22:27, sheridan@sheridan-mahoney.com a écrit :
Hi, I've been looking into MultiByteFileStream for adding tests in this area, and have come up against what appears to me to be an anomaly. I ran the following 4 tests:
FileStream fileNamed: 'test.txt' do: [ :str | str nextPutAll: '123'; crlf ].
MultiByteFileStream fileNamed: 'test2.txt' do: [ :str | str nextPutAll: '123'; crlf ].
FileStream fileNamed: 'test3.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ].
MultiByteFileStream fileNamed: 'test4.txt' do: [ :str | str nextPutAll: 'élève en Français'; crlf ].
The results are:
Input string Result Unix File Class Class Type --------------------------------------------------------------- FileStream '123' MultiByte- ASCII text FileStream
MultiByte- '123' MultiByte- ASCII text FileStream FileStream
FileStream 'élève en MultiByte- UTF-8 Unicode Français' FileStream
MultiByte- 'élève en MultiByte- UTF-8 Unicode FileStream Français' FileStream
Do operations involving FileStream as input always return a MultiByteFileStream?
Thanks, Sheridan
participants (3)
-
sheridan@sheridan-mahoney.com -
stepharo -
Sven Van Caekenberghe