X Tutup
Skip to content

Commit 64046ba

Browse files
author
Johan Brichau
committed
cross-platform codec tests
1 parent 7a9d88e commit 64046ba

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
running
22
setUp
33
| codecStream |
4-
codecStream := ((GRCodec forEncoding: 'utf-8') encoderFor: (WriteStream on: ByteArray new)).
4+
codecStream := ((GRCodec forEncoding: 'utf-8') encoderFor: (WriteStream on: (GRCodec forEncoding: 'utf-8') encodedStringClass new)).
55
countingStream := GRCountingStream on: codecStream

repository/Grease-Tests-Core.package/GRUtf8CodecTest.class/instance/testCodecUtf8BorderLineString.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ testCodecUtf8BorderLineString
33
#('UTF-8' 'utf-8') do: [ :codecName |
44
| codec writeStream |
55
codec := GRCodec forEncoding: codecName.
6-
writeStream := codec encoderFor: GRPlatform current readWriteByteStream.
6+
writeStream := codec encoderFor: (GRPlatform current writeCharacterStreamOn: codec encodedStringClass new).
77
writeStream nextPut: (Character codePoint: 0).
88
writeStream nextPut: (Character codePoint: 255).
99
writeStream nextPut: (Character codePoint: 256).

repository/Grease-Tests-Core.package/GRUtf8CodecTest.class/instance/testCodecUtf8ShortestForm.st

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ testCodecUtf8ShortestForm
55
#('UTF-8' 'utf-8') do: [ :codecName |
66
| codec abc |
77
codec := GRCodec forEncoding: codecName.
8-
abc := self asByteArray: #(193 129 193 130 193 131 ).
8+
codec encodedStringClass == ByteArray
9+
ifTrue:[ abc := self asByteArray: #(193 129 193 130 193 131 ) ]
10+
ifFalse:[ abc := self asString: #(193 129 193 130 193 131 ) ].
911
self
1012
should: [ self deny: (codec decode: abc) = 'ABC' ]
1113
raise: Error ]
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
accessing
22
utf8StringOrByteArrayForCodec: codec
3+
| bytes |
4+
bytes := #(195 156 98 195 168 114 115 116 114 195 174 195 177 103 195 169).
35
^ codec encodedStringClass == ByteArray
4-
ifTrue:[ self asByteArray: #(195 156 98 195 168 114 115 116 114 195 174 195 177 103 195 169) ]
5-
ifFalse:[ self asString: #(195 156 98 195 168 114 115 116 114 195 174 195 177 103 195 169) ]
6+
ifTrue:[ self asByteArray: bytes ]
7+
ifFalse:[ self asString: bytes ]

0 commit comments

Comments
 (0)
X Tutup