class TestGroupConditions

Public Instance Methods

setup_group() click to toggle source
# File vendor/qwik/lib/qwik/group-cond.rb, line 82
def setup_group
  return QuickML::Group.new(@ml_config, 'test@example.com')
end
test_all() click to toggle source
# File vendor/qwik/lib/qwik/group-cond.rb, line 86
def test_all
  c = QuickML::Group

  group = setup_group

  t_make_readable(QuickML::Group, :db)

  # ==================== Conditions.
  # test_newly_created?
  ok_eq(true, group.newly_created?)

  # ==================== Count
  # test_init_count
  t_make_public(QuickML::Group, :init_count)
  group.init_count

  t_make_readable(QuickML::Group, :count)
  ok_eq(0, group.count)
  ok_eq(nil, group.db.get(:Count))

  # test_inc_count
  t_make_public(QuickML::Group, :inc_count)
  group.inc_count
  ok_eq(1, group.count)
  ok_eq('1', group.db.get(:Count))

  # test_load_count
  ok_eq(1, c.load_count(group.db))
  group.inc_count
  ok_eq(2, c.load_count(group.db))

  # ==================== Charset
  # test_init_charset
  t_make_public(QuickML::Group, :init_charset)
  group.init_charset

  t_make_readable(QuickML::Group, :charset)
  ok_eq(nil, group.charset)

  # test_parse_charset
  ok_eq('', c.parse_charset(''))
  ok_eq('t', c.parse_charset("t\n"))
  ok_eq('t', c.parse_charset("t\ns\n"))
  ok_eq('iso-2022-jp', c.parse_charset("iso-2022-jp\n"))

  # test_save_charset
  t_make_public(QuickML::Group, :save_charset)
  group.save_charset('iso-2022-jp')
  ok_eq("iso-2022-jp\n", group.db.get(:Charset))
  group.init_charset
  ok_eq('iso-2022-jp', group.charset)

  # test_load_charset
  ok_eq('iso-2022-jp', c.load_charset(group.db))

  # ==================== Alertedp
  # test_alerted?
  t_make_public(QuickML::Group, :alerted?)
  ok_eq(false, group.alerted?)

  # test_close_alertedp_file
  t_make_public(QuickML::Group, :close_alertedp_file)
  group.close_alertedp_file
  ok_eq(true, group.alerted?)

  # test_remove_alertedp_file
  t_make_public(QuickML::Group, :remove_alertedp_file)
  group.remove_alertedp_file
  ok_eq(false, group.alerted?)
end