diff options
author | Matthias Hecker <mail@apoc.cc> | 2020-03-29 12:46:43 +0200 |
---|---|---|
committer | Matthias Hecker <mail@apoc.cc> | 2020-03-29 12:46:43 +0200 |
commit | b047b669c3426afebf9f6397a56cb3e7c0beb366 (patch) | |
tree | ed68361ba975243c20b3c6f24b25f4699fcf30c3 /test/test_registry.rb | |
parent | 8dc14bf88cbf38496aa21c2c17e42b211e7e1278 (diff) |
test: small changes and fixes to existing tests
Diffstat (limited to 'test/test_registry.rb')
-rw-r--r-- | test/test_registry.rb | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/test/test_registry.rb b/test/test_registry.rb index c6d68902..1f25f89d 100644 --- a/test/test_registry.rb +++ b/test/test_registry.rb @@ -1,5 +1,14 @@ $:.unshift File.join(File.dirname(__FILE__), '../lib') +module Irc +class Bot + module Config + @@datadir = File.expand_path(File.dirname($0) + '/../data/rbot') + @@coredir = File.expand_path(File.dirname($0) + '/../lib/rbot/core') + end +end +end + require 'test/unit' require 'rbot/ircbot' require 'rbot/registry' @@ -293,34 +302,39 @@ class RegistryTCTest < Test::Unit::TestCase end end -class RegistryDaybreakTest < Test::Unit::TestCase - include RegistryTestModule - include RegistryHashInterfaceTests - - def initialize(o) - super o - @format = 'daybreak' - Irc::Bot::Registry.new(@format) - @registry_class = Irc::Bot::Registry::DaybreakAccessor - end -end - -class RegistrySqliteTest < Test::Unit::TestCase - include RegistryTestModule - include RegistryHashInterfaceTests - - def initialize(o) - super o - @format = 'sqlite' - Irc::Bot::Registry.new(@format) - @registry_class = Irc::Bot::Registry::SqliteAccessor +begin + require 'daybreak' + class RegistryDaybreakTest < Test::Unit::TestCase + include RegistryTestModule + include RegistryHashInterfaceTests + + def initialize(o) + super o + @format = 'daybreak' + Irc::Bot::Registry.new(@format) + @registry_class = Irc::Bot::Registry::DaybreakAccessor + end end +rescue Exception; end + +begin + require 'sqlite' + class RegistrySqliteTest < Test::Unit::TestCase + include RegistryTestModule + include RegistryHashInterfaceTests + + def initialize(o) + super o + @format = 'sqlite' + Irc::Bot::Registry.new(@format) + @registry_class = Irc::Bot::Registry::SqliteAccessor + end - def test_duplicate_keys - @reg['foo'] = 1 - @reg['foo'] = 2 - res = @reg.registry.execute('select key from data') - assert res.length == 1 + def test_duplicate_keys + @reg['foo'] = 1 + @reg['foo'] = 2 + res = @reg.registry.execute('select key from data') + assert res.length == 1 + end end -end - +rescue Exception; end |