C0 code coverage information
Generated on Sun Jul 06 22:30:58 +0900 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 #!/usr/bin/env ruby
2
3 Thread.abort_on_exception = true
4
5 require "rubygems"
6 require "spec"
7
8 require "pathname"
9 require Pathname.new(__FILE__).parent + "../lib/citrus.rb"
10
11 require "tmpdir"
12
13 class Pathname
14 @@tempname_number = 0
15 def self.tempname(base=$0, dir=Dir.tmpdir)
16 @@tempname_number += 1
17 name = "#{dir}/#{File.basename(base)}.#{$$}.#{@@tempname_number}"
18 path = new(name)
19 at_exit do
20 path.rmtree if path.exist?
21 end
22 path
23 end
24 end
25
26 require "thread"
27
28 class QueueWithTimeout < Queue
29 def initialize(timeout)
30 super()
31 @timeout = timeout
32 end
33
34 def pop(*args)
35 timeout(@timeout) do
36 super
37 end
38 end
39
40 def push(*args)
41 timeout(@timeout) do
42 super
43 end
44 end
45 end
46
47 class DummyCore < Citrus::Core
48 def initialize(opts={})
49 @base = Pathname.tempname
50 config = @base + "config.yaml"
51
52 data_dir = @base + "data"
53 data_dir.mkpath
54
55 plug_dir = @base + "plugins"
56 plug_dir.mkpath
57
58 config.open("w") do |f|
59 conf = {
60 "general" => {
61 "host" => "localhost",
62 "port" => "6669",
63 "nick" => "foonick",
64 "user" => "foouser",
65 "real" => "foo real name",
66 "plugin_dir" => plug_dir.to_s,
67 "data_dir" => data_dir.to_s,
68 "log" => "/dev/null",
69 "error" => "#chokan",
70 }.merge(opts["general"] || {}),
71 "plugins" => {
72 }.merge(opts["plugins"] || {})
73 }
74 YAML.dump(conf, f)
75 end
76
77 super(config)
78
79 @socket = QueueWithTimeout.new(5)
80 end
81
82 def start
83 end
84
85 def finish
86 end
87 end
88
89 def tests(&block)
90 yield
91 end
92
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.