Nicolas Cellier uploaded a new version of MultilingualTests to project The Trunk:
http://source.squeak.org/trunk/MultilingualTests-nice.17.mcz ==================== Summary ==================== Name: MultilingualTests-nice.17 Author: nice Time: 31 October 2013, 11:54:33.464 pm UUID: 6de55950-5fff-43d1-9ce0-8b661515f618 Ancestors: MultilingualTests-tpr.16 Add a test showing that MultiByteFileStream>>nextChunk fails to honour its own lineEndConvention. =============== Diff against MultilingualTests-tpr.16 =============== Item was added: + ----- Method: MultiByteFileStreamTest>>testLineEndingChunk (in category 'testing') ----- + testLineEndingChunk + + fileName := 'foolinend.txt'. + MultiByteFileStream forceNewFileNamed: fileName do: [ :file | + file + wantsLineEndConversion: false; + nextPutAll: 'line 1'; cr; + nextPutAll: 'line 2'; crlf; + nextPutAll: 'line 3'; lf; + nextPutAll: 'line 4'; nextPut: $!! ]. + { + {#cr. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. + {#lf. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. + {#crlf. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. + {nil. 'line 1' , String cr , 'line 2' , String crlf , 'line 3' , String lf , 'line 4'} + } do: [:lineEndingResult | + MultiByteFileStream oldFileNamed: fileName do: [ :file | + file lineEndConvention: lineEndingResult first. + self assert: lineEndingResult last equals: file nextChunk ] ]! |
I think it's intentional. The content of the chunks shouldn't be changed
while being read. Let's say I implement #isCr: as isCr: aCharacter ^$ == aCharacter By default it will return true if the argument foo is a carriage return character, otherwise false. But if we allow changing the line endings in chunks, then its behavior might be different after loading. Levente On Thu, 31 Oct 2013, [hidden email] wrote: > Nicolas Cellier uploaded a new version of MultilingualTests to project The Trunk: > http://source.squeak.org/trunk/MultilingualTests-nice.17.mcz > > ==================== Summary ==================== > > Name: MultilingualTests-nice.17 > Author: nice > Time: 31 October 2013, 11:54:33.464 pm > UUID: 6de55950-5fff-43d1-9ce0-8b661515f618 > Ancestors: MultilingualTests-tpr.16 > > Add a test showing that MultiByteFileStream>>nextChunk fails to honour its own lineEndConvention. > > =============== Diff against MultilingualTests-tpr.16 =============== > > Item was added: > + ----- Method: MultiByteFileStreamTest>>testLineEndingChunk (in category 'testing') ----- > + testLineEndingChunk > + > + fileName := 'foolinend.txt'. > + MultiByteFileStream forceNewFileNamed: fileName do: [ :file | > + file > + wantsLineEndConversion: false; > + nextPutAll: 'line 1'; cr; > + nextPutAll: 'line 2'; crlf; > + nextPutAll: 'line 3'; lf; > + nextPutAll: 'line 4'; nextPut: $!! ]. > + { > + {#cr. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. > + {#lf. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. > + {#crlf. 'line 1' , String cr , 'line 2' , String cr , 'line 3' , String cr , 'line 4'}. > + {nil. 'line 1' , String cr , 'line 2' , String crlf , 'line 3' , String lf , 'line 4'} > + } do: [:lineEndingResult | > + MultiByteFileStream oldFileNamed: fileName do: [ :file | > + file lineEndConvention: lineEndingResult first. > + self assert: lineEndingResult last equals: file nextChunk ] ]! > > > |
I don't think it would be sane to rely on this. But even if we'd really want this feature, then it is broken by virtue of nextChunkPut: which does honour the lineEndConvention... So we have to change one or the other.2013/11/1 Levente Uzonyi <[hidden email]> I think it's intentional. The content of the chunks shouldn't be changed while being read. Let's say I implement #isCr: as |
Free forum by Nabble | Edit this page |