aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-11-25 22:58:20 -0300
committerdequis <dx@dxzone.com.ar>2015-11-25 22:59:00 -0300
commit42a418e60fb5d3dfbcd9bdc5251bf4a6047bc3c5 (patch)
tree24d003f74bcc4a6239292efbe69686d5f09a8a9a
parent755470287207c4b580b722536889a8bb9d9427bf (diff)
help: free strings added by help_add_mem()
Not really a leak, but I want valgrind to be happy because valgrind is nice to me. I love you valgrind <3
-rw-r--r--help.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/help.c b/help.c
index 07ba2102..280d4862 100644
--- a/help.c
+++ b/help.c
@@ -104,7 +104,9 @@ void help_free(help_t **help)
h = *help;
while (h) {
- if (h->fd != last_fd) {
+ if (h->fd == -1) {
+ g_free(h->offset.mem_offset);
+ } else if (h->fd != last_fd) {
close(h->fd);
last_fd = h->fd;
}
.20.0.15 Unnamed repository; edit this file 'description' to name the repository.MimesBrønn
aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rdoc-2.4.3/test/test_rdoc_ri_driver.rb
blob: f160492057f08dcb87b6322d5ca7aca35feb0467 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
require 'rubygems'
require 'minitest/unit'
require 'tmpdir'
require 'rdoc/ri/driver'

class TestRDocRIDriver < MiniTest::Unit::TestCase

  def setup
    @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
    @home_ri = File.join @tmpdir, 'dot_ri'
    @cache_dir = File.join @home_ri, 'cache'
    @class_cache = File.join @cache_dir, 'classes'

    FileUtils.mkdir_p @tmpdir
    FileUtils.mkdir_p @home_ri
    FileUtils.mkdir_p @cache_dir

    @driver = RDoc::RI::Driver.new(RDoc::RI::Driver.process_args([]))
    @driver.homepath = @home_ri
  end

  def teardown
    FileUtils.rm_rf @tmpdir
  end

  def test_lookup_method
    def @driver.load_cache_for(klassname)
      { 'Foo#bar' => :found }
    end

    assert @driver.lookup_method('Foo#bar',  'Foo')
  end

  def test_lookup_method_class_method
    def @driver.load_cache_for(klassname)
      { 'Foo::Bar' => :found }
    end

    assert @driver.lookup_method('Foo::Bar', 'Foo::Bar')
  end

  def test_lookup_method_class_missing
    def @driver.load_cache_for(klassname) end

    assert_nil @driver.lookup_method('Foo#bar', 'Foo')
  end

  def test_lookup_method_dot_instance
    def @driver.load_cache_for(klassname)
      { 'Foo#bar' => :instance, 'Foo::bar' => :klass }
    end

    assert_equal :instance, @driver.lookup_method('Foo.bar', 'Foo')
  end

  def test_lookup_method_dot_class
    def @driver.load_cache_for(klassname)
      { 'Foo::bar' => :found }
    end

    assert @driver.lookup_method('Foo.bar', 'Foo')
  end

  def test_lookup_method_method_missing
    def @driver.load_cache_for(klassname) {} end

    assert_nil @driver.lookup_method('Foo#bar', 'Foo')
  end

  def test_parse_name
    klass, meth = @driver.parse_name 'Foo::Bar'

    assert_equal 'Foo::Bar', klass, 'Foo::Bar class'
    assert_equal nil,        meth,  'Foo::Bar method'

    klass, meth = @driver.parse_name 'Foo#Bar'

    assert_equal 'Foo', klass, 'Foo#Bar class'
    assert_equal 'Bar', meth,  'Foo#Bar method'

    klass, meth = @driver.parse_name 'Foo.Bar'

    assert_equal 'Foo', klass, 'Foo#Bar class'
    assert_equal 'Bar', meth,  'Foo#Bar method'

    klass, meth = @driver.parse_name 'Foo::bar'

    assert_equal 'Foo', klass, 'Foo::bar class'
    assert_equal 'bar', meth,  'Foo::bar method'
  end

end

MiniTest::Unit.autorun