File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
Grease-Core.package/GRPlatform.class/instance
Grease-Pharo100-Core.package/GRPharoPlatform.class/instance
Grease-Tests-Core.package/GRPlatformTest.class/instance Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ encoding
2+ base64Encode: aByteArray
3+ " Base64 encode the given byte array and answer the result as a String."
4+ self subclassResponsibility
Original file line number Diff line number Diff line change 1+ encoding
2+ base64Encode: aByteArray
3+ ^ aByteArray base64Encoded
Original file line number Diff line number Diff line change 1+ tests
2+ testBase64Encode
3+ | input |
4+ input := #(
5+ (97 110 121 32 99 97 114 110 97 108 32 112 108 101 97 115 117 114 101 46) ' YW55IGNhcm5hbCBwbGVhc3VyZS4='
6+ (97 110 121 32 99 97 114 110 97 108 32 112 108 101 97 115 117 114 101 ) ' YW55IGNhcm5hbCBwbGVhc3VyZQ=='
7+ (97 110 121 32 99 97 114 110 97 108 32 112 108 101 97 115 117 114 ) ' YW55IGNhcm5hbCBwbGVhc3Vy'
8+ (97 110 121 32 99 97 114 110 97 108 32 112 108 101 97 115 117 ) ' YW55IGNhcm5hbCBwbGVhc3U='
9+ (97 110 121 32 99 97 114 110 97 108 32 112 108 101 97 115 ) ' YW55IGNhcm5hbCBwbGVhcw==' ).
10+ 1 to: input size by: 2 do: [ :index |
11+ | decoded expected |
12+ decoded := GRPlatform current base64Encode: (input at: index) asByteArray.
13+ expected := input at: index + 1 .
14+ self assert: decoded = expected ]
You can’t perform that action at this time.
0 commit comments