Xregistry

Check-in [d1ec4fbec8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add tests.
Timelines: family | ancestors | descendants | both | trunk | version-1.3.3
Files: files | file ages | folders
SHA1:d1ec4fbec8172c9efd8d9c8062571c0ff35421b9
User & Date: wbp 2016-02-06 22:12:02
Context
2016-02-14
03:44
Fix implementation of deleteSection under Windows. check-in: e0ac02449c user: wbp tags: trunk, version-1.3.4
2016-02-06
22:12
Add tests. check-in: d1ec4fbec8 user: wbp tags: trunk, version-1.3.3
21:42
Remove Makefile, add LICENSE to distribution tarball, and uninstall target to Rakefile. check-in: bb9023f2cb user: wbp tags: trunk, version-1.3.2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Rakefile.

1
2
3


4
5
6
7
8
9
10
..
36
37
38
39
40
41
42


# Rakefile for xregistry gem.
# Last modified:  06-Feb-2016  Wm. Parsons



name    = 'xregistry'
version = %x[cat VERSION].chomp
package = "#{name}-#{version}"

distfiles = %w[
  LICENSE
  Rakefile
................................................................................
  system "gem install --user-install #{package}.gem"
end

desc "Uninstall #{name} gem"
task :uninstall do
  system "gem uninstall #{name} -v #{version}"
end





>
>







 







>
>
1
2
3
4
5
6
7
8
9
10
11
12
..
38
39
40
41
42
43
44
45
46
# Rakefile for xregistry gem.
# Last modified:  06-Feb-2016  Wm. Parsons

require 'rake/testtask'

name    = 'xregistry'
version = %x[cat VERSION].chomp
package = "#{name}-#{version}"

distfiles = %w[
  LICENSE
  Rakefile
................................................................................
  system "gem install --user-install #{package}.gem"
end

desc "Uninstall #{name} gem"
task :uninstall do
  system "gem uninstall #{name} -v #{version}"
end

Rake::TestTask.new :test

Changes to VERSION.

1
1.3.2
|
1
1.3.3

Added test/test_xregistry.rb.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# test program for wregistry gem
# Last modified:  06-Feb-2016

require 'xregistry'
require 'test/unit'

class TestWregistry < Test::Unit::TestCase
  def setup
    @@reg ||= Registry.new('testxreg', 'Wikareia')
  end

  def test_new
    assert_equal(Registry, @@reg.class)
  rescue
    flunk "error encountered opening database: #{$!}"
  end

  # test of readIntEntry
  def test_read_int_entry
    value = @@reg.readIntEntry('Settings', 'int_key1', 123)
    assert_equal(123, value)
  end

  # test of readStringEntry
  def test_read_string_entry
    string = @@reg.readStringEntry('Settings', 'string_key1', 'default value')
    assert_match(/ value/, string)
  end

  # test of writeIntEntry
  def test_write_int_entry
    @@reg.writeIntEntry('Settings', 'int_key2', 456)
    value = @@reg.readIntEntry('Settings', 'int_key2', nil)
    assert_equal(456, value)
  end

  # test of writeStringEntry
  def test_write_string_entry
    @@reg.writeStringEntry('Settings', 'string_key2', 'test value')
    string = @@reg.readStringEntry('Settings', 'string_key2', nil)
    assert_equal('test value', string)
  end

  # test of deleteSection
  def test_delete_section
    @@reg.deleteSection('Settings')
    string = @@reg.readStringEntry('Settings', 'section', 'no value')
    assert_equal('no value', string)

    # test of deleteSection when section doesn't exist
    @@reg.deleteSection('Settings')
    string = @@reg.readStringEntry('Settings', 'section', 'no value')
    assert_equal('no value', string)
  end
end