Skip to content

Commit 9ebe3a1

Browse files
committed
tests: Test that all returned Strings are unfrozen
1 parent 1827e1e commit 9ebe3a1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/lib/ascii85_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
end
6464
end
6565

66+
it 'should always return unfrozen Strings' do
67+
TEST_CASES.each_pair do |input, encoded|
68+
assert_equal false, Ascii85.encode(input).frozen?
69+
end
70+
end
71+
6672
it 'should encode Strings in different encodings correctly' do
6773
input_euc_jp = 'どうもありがとうミスターロボット'.encode('EUC-JP')
6874
input_binary = input_euc_jp.force_encoding('ASCII-8BIT')
@@ -143,6 +149,12 @@
143149
end
144150
end
145151

152+
it 'should always return unfrozen Strings' do
153+
TEST_CASES.each_pair do |input, encoded|
154+
assert_equal false, Ascii85.decode(encoded).frozen?
155+
end
156+
end
157+
146158
it 'should accept valid input in encodings other than the default' do
147159
input = 'Ragnarök τέχνη русский язык I ♥ Ruby'
148160
input_ascii85 = Ascii85.encode(input)
@@ -221,6 +233,13 @@
221233
end
222234
end
223235

236+
it 'should always return unfrozen Strings' do
237+
TEST_CASES.each_pair do |decoded, input|
238+
raw_input = input[2...-2] # Remove '<~' and '~>'
239+
assert_equal false, Ascii85.decode_raw(raw_input).frozen?
240+
end
241+
end
242+
224243
it 'should decode from an IO object' do
225244
input = StringIO.new(';KZGo')
226245
result = Ascii85.decode_raw(input)

0 commit comments

Comments
 (0)