test/cases/gigo_test.rb in gigo-1.0.0 vs test/cases/gigo_test.rb in gigo-1.1.0
- old
+ new
@@ -8,10 +8,11 @@
let(:data_utf8_emoji) { "💖" }
let(:data_utf8) { "€20 – “Woohoo”" }
let(:data_bad_readin) { "�20 � �Woohoo�" }
let(:data_cp1252) { data_utf8.encode('CP1252') }
+ let(:data_bin_apos) { "won\x92t".force_encoding('binary') }
let(:data_really_bad) { "ed.Ã\u0083Ã\u0083\xC3" }
describe '.load' do
@@ -20,20 +21,24 @@
GIGO.load(nil).must_be_nil
o = Object.new
GIGO.load(o).must_equal o
end
+ it 'fixes windows apostrophe' do
+ GIGO.load(data_bin_apos).must_equal "won’t"
+ end
+
it 'should allows properly encoded and marked strings to be passed thru' do
GIGO.load(data_utf8).must_equal data_utf8
GIGO.load(data_utf8_emoji).must_equal data_utf8_emoji
end
it 'allows data already read in with question marks to pass thru' do
GIGO.load(data_bad_readin).must_equal data_bad_readin
end
it 'allows really bad data to be encoded using default replace and question marks' do
- GIGO.load(data_utf8_emoji.force_encoding('ASCII-8BIT')).must_equal '����'
+ GIGO.load(data_utf8_emoji.force_encoding('ASCII-8BIT')).must_equal data_utf8_emoji
end
it 'converts windows codepages that are poorly marked as another encoding' do
db_data1 = data_cp1252.dup.force_encoding('ASCII-8BIT')
GIGO.load(db_data1).must_equal data_utf8