File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed
repository/Grease-Tests-Core.package
GRCountingStreamTest.class/instance
GRUtf8CodecTest.class/instance Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11running
22setUp
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
Original file line number Diff line number Diff 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 ).
Original file line number Diff line number Diff 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 ]
Original file line number Diff line number Diff line change 11accessing
22utf8StringOrByteArrayForCodec: 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 ]
You can’t perform that action at this time.
0 commit comments