Sha256: 7208f3ddf3b491308b46588f400b84c38f04ebe0caed7b2ccb12d19c5e2fa835
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
require "tempfile" require "sakuru/database" class DatabaseTest < Test::Unit::TestCase def setup @database = Sakuru::Database.new end def test_add @database.add(__FILE__) assert_equal([__FILE__], @database.files) end def test_search @database.add(__FILE__) assert_equal({__FILE__ => 1}, @database.search("DatabaseTest")) end def test_search_not_match @database.add(__FILE__) assert_equal({}, @database.search("\0")) end def test_save @database.add(__FILE__) file = Tempfile.new("sakuru") @database.save(file) file.flush assert_equal([__FILE__], JSON.load(file)["files"]) end def test_load data = { "files" => ["piyo.txt"], "inverted_index" => {}, } file = Tempfile.new("sakuru") JSON.dump(data, file) file.flush @database.load(file) assert_equal(["piyo.txt"], @database.files) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sakuru-0.0.1 | test/test-database.rb |