Codebase list ruby-fxruby / 867a9ad8-16f3-49f2-8da1-08141b9b00dd/upstream/1.6.45+git20221125.1.7d76b2a test / TC_FXSettings.rb
867a9ad8-16f3-49f2-8da1-08141b9b00dd/upstream/1.6.45+git20221125.1.7d76b2a

Tree @867a9ad8-16f3-49f2-8da1-08141b9b00dd/upstream/1.6.45+git20221125.1.7d76b2a (Download .tar.gz)

TC_FXSettings.rb @867a9ad8-16f3-49f2-8da1-08141b9b00dd/upstream/1.6.45+git20221125.1.7d76b2araw · history · blame

require 'test/unit'
require 'fox16'
require 'testcase'

class TC_FXSettings < Fox::TestCase
  include Fox


  def setup
    super(self.class.name)
  end

  def test_each_section_empty_settings
    empty = FXSettings.new
    num_sections = 0
    empty.each_section do |sect|
      num_sections = num_sections + 1
    end
    assert_equal(0, num_sections)
  end

  def test_each_section
    settings = FXSettings.new
    settings.writeStringEntry('sect1', 'key1', 'value1')
    settings.writeStringEntry('sect2', 'key2', 'value2')
    keys = []
    settings.each_section do |sect|
      sect.each_key do |key|
        keys << key
      end
    end
    assert_equal(['key1', 'key2'], keys.sort)
  end
end