test/test.rb in daybreak-0.2.2 vs test/test.rb in daybreak-0.2.3

- old
+ new

@@ -1,5 +1,6 @@ +# encoding: utf-8 require 'minitest/autorun' require 'minitest/benchmark' require 'set' @@ -19,10 +20,17 @@ @db[1] = '2' assert_equal @db[1], '2' assert_equal @db.length, 1 end + it 'should support frozen key' do + key = 'key' + key.freeze + @db[key] = 'value' + assert_equal @db[key], 'value' + end + it 'should support batch inserts' do @db.update(1 => :a, 2 => :b) assert_equal @db[1], :a assert_equal @db[2], :b assert_equal @db.length, 2 @@ -384,9 +392,17 @@ db.close end it 'should report the bytesize' do assert @db.bytesize > 0 + end + + it 'should accept utf-8 keys' do + @db['🌎'] = '🌎' + @db.flush + db = Daybreak::DB.new DB_PATH + assert_equal db['🌎'], '🌎' + db.close end after do @db.clear @db.close