The Inbox: MultilingualTests-tonyg.22.mcz

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

The Inbox: MultilingualTests-tonyg.22.mcz

commits-2
A new version of MultilingualTests was added to project The Inbox:
http://source.squeak.org/inbox/MultilingualTests-tonyg.22.mcz

==================== Summary ====================

Name: MultilingualTests-tonyg.22
Author: tonyg
Time: 23 February 2017, 2:01:47.977527 pm
UUID: 76769ce3-a15d-46a7-acbd-8acfbd56fcc9
Ancestors: MultilingualTests-pre.21

Test cases from Mantis #4665.

=============== Diff against MultilingualTests-pre.21 ===============

Item was added:
+ ----- Method: MultiByteFileStreamTest>>testUpToAllAscii (in category 'testing') -----
+ testUpToAllAscii
+ "This test case is inspired by Mantis #4665."
+ "Compare to testUpToAllUtf."
+
+ | in out fn resultA resultB |
+ fn :='testUpToAll.in'.
+ out := FileDirectory default forceNewFileNamed: fn.
+ out nextPutAll: 'A<'. "Encodes to byte sequence 413C"
+ out close.
+
+ in := FileDirectory default readOnlyFileNamed: fn.
+ resultA := in upToAll: '<'.
+ in close.
+
+ in := FileDirectory default readOnlyFileNamed: fn.
+ resultB := in upTo: $<.
+ in close.
+
+ self assert: resultA = resultB
+ !

Item was added:
+ ----- Method: MultiByteFileStreamTest>>testUpToAllUtf (in category 'testing') -----
+ testUpToAllUtf
+ "This test case is adapted from Mantis #4665."
+ "MultiByteFileStream was relying on PositionableStream>>#match: to discover the position immediately following the delimiter collection. It would then use #next: to retrieve a number of *characters* computed as the difference in stream positions. However, stream positions are measured in *bytes*, not characters, so this would lead to misalignment when the skipped text included UTF-8 encoded characters."
+
+ | in out fn resultA resultB |
+ fn :='testUpToAll.in'.
+ out := FileDirectory default forceNewFileNamed: fn.
+ out nextPutAll: 231 asCharacter asString, '<'. "Encodes to byte sequence C3A73C"
+ out close.
+
+ in := FileDirectory default readOnlyFileNamed: fn.
+ resultA := in upToAll: '<'.
+ in close.
+
+ in := FileDirectory default readOnlyFileNamed: fn.
+ resultB := in upTo: $<.
+ in close.
+
+ self assert: resultA = resultB
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: MultilingualTests-tonyg.22.mcz

Hannes Hirzel
The change was merged into trunk with

MultilingualTests-pre.26.mcz

Test cases from Mantis #4665.

On Thu, 23 Feb 2017 19:01:55 0000, [hidden email]
<[hidden email]> wrote:

> A new version of MultilingualTests was added to project The Inbox:
> http://source.squeak.org/inbox/MultilingualTests-tonyg.22.mcz
>
> ==================== Summary ====================
>
> Name: MultilingualTests-tonyg.22
> Author: tonyg
> Time: 23 February 2017, 2:01:47.977527 pm
> UUID: 76769ce3-a15d-46a7-acbd-8acfbd56fcc9
> Ancestors: MultilingualTests-pre.21
>
> Test cases from Mantis #4665.
>
> =============== Diff against MultilingualTests-pre.21 ===============
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>testUpToAllAscii (in category
> 'testing') -----
> + testUpToAllAscii
> + "This test case is inspired by Mantis #4665."
> + "Compare to testUpToAllUtf."
> +
> + | in out fn resultA resultB |
> + fn :='testUpToAll.in'.
> + out := FileDirectory default forceNewFileNamed: fn.
> + out nextPutAll: 'A<'. "Encodes to byte sequence 413C"
> + out close.
> +
> + in := FileDirectory default readOnlyFileNamed: fn.
> + resultA := in upToAll: '<'.
> + in close.
> +
> + in := FileDirectory default readOnlyFileNamed: fn.
> + resultB := in upTo: $<.
> + in close.
> +
> + self assert: resultA = resultB
> + !
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>testUpToAllUtf (in category
> 'testing') -----
> + testUpToAllUtf
> + "This test case is adapted from Mantis #4665."
> + "MultiByteFileStream was relying on PositionableStream>>#match: to
> discover the position immediately following the delimiter collection. It
> would then use #next: to retrieve a number of *characters* computed as the
> difference in stream positions. However, stream positions are measured in
> *bytes*, not characters, so this would lead to misalignment when the skipped
> text included UTF-8 encoded characters."
> +
> + | in out fn resultA resultB |
> + fn :='testUpToAll.in'.
> + out := FileDirectory default forceNewFileNamed: fn.
> + out nextPutAll: 231 asCharacter asString, '<'. "Encodes to byte sequence
> C3A73C"
> + out close.
> +
> + in := FileDirectory default readOnlyFileNamed: fn.
> + resultA := in upToAll: '<'.
> + in close.
> +
> + in := FileDirectory default readOnlyFileNamed: fn.
> + resultB := in upTo: $<.
> + in close.
> +
> + self assert: resultA = resultB
> + !
>
>
>