require "registry"

DEBUG = false

Registry::open {
  keys = Registry::keys
  puts "#{keys.length} keys" if DEBUG
  raise "Bad get keys" unless keys.length >= 2

  # Testing set value
  Registry::set( "user/lib/registry/version", "0.2.2" )
  puts "set 'user/lib/registry/version' => "+
    "#{Registry::get('user/lib/registry').inspect}" if DEBUG
  raise "Bad set/get" unless Registry::get("user/lib/registry/version") == "0.2.2"

  klen = Registry::keys.length
  puts "#{klen} keys" if DEBUG
  raise "Keys didn't work" unless klen == keys.length+1

  Registry::remove( "user/lib/registry/version" )
  puts "removed 'user/lib/registry/version' => "+
    "#{Registry::get('user/lib/registry').inspect}" if DEBUG

  klen = Registry::keys.length
  puts "#{klen} keys" if DEBUG
  raise "Remove didn't work" unless klen == keys.length
}
