simplecov 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -7
- data/Gemfile.lock +7 -10
- data/LICENSE +1 -1
- data/README.rdoc +59 -7
- data/Rakefile +15 -27
- data/lib/simplecov.rb +16 -7
- data/lib/simplecov/configuration.rb +1 -0
- data/lib/simplecov/result.rb +1 -1
- data/lib/simplecov/version.rb +3 -0
- data/simplecov.gemspec +20 -101
- data/test/helper.rb +10 -5
- data/test/shoulda_macros.rb +11 -0
- data/test/test_1_8_fallbacks.rb +33 -0
- data/test/test_command_guesser.rb +13 -11
- data/test/test_filters.rb +53 -51
- data/test/test_merge_helpers.rb +76 -74
- data/test/test_result.rb +95 -93
- data/test/test_return_codes.rb +26 -24
- data/test/test_source_file.rb +45 -43
- data/test/test_source_file_line.rb +78 -76
- metadata +15 -26
- data/VERSION +0 -1
data/test/test_return_codes.rb
CHANGED
@@ -3,35 +3,37 @@ require 'helper'
|
|
3
3
|
# Make sure that exit codes of tests are propagated properly when using
|
4
4
|
# simplecov. See github issue #5
|
5
5
|
class TestReturnCodes < Test::Unit::TestCase
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
on_ruby '1.9' do
|
7
|
+
context "Inside fixtures/frameworks" do
|
8
|
+
setup do
|
9
|
+
@current_dir = Dir.getwd
|
10
|
+
Dir.chdir(File.join(File.dirname(__FILE__), 'fixtures', 'frameworks'))
|
11
|
+
FileUtils.rm_rf('./coverage')
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
should "have return code 0 when running testunit_good.rb" do
|
15
|
+
`ruby testunit_good.rb`
|
16
|
+
assert_equal 0, $?.exitstatus
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
should "have return code 0 when running rspec_good.rb" do
|
20
|
+
`rspec rspec_good.rb`
|
21
|
+
assert_equal 0, $?.exitstatus
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
should "have return code 1 when running testunit_bad.rb" do
|
25
|
+
`ruby testunit_bad.rb`
|
26
|
+
assert_equal 1, $?.exitstatus
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
should "have return code 1 when running rspec_bad.rb" do
|
30
|
+
`rspec rspec_bad.rb`
|
31
|
+
assert_equal 1, $?.exitstatus
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
teardown do
|
35
|
+
Dir.chdir(@current_dir)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
data/test/test_source_file.rb
CHANGED
@@ -1,49 +1,51 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestSourceFile < Test::Unit::TestCase
|
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
|
-
|
4
|
+
on_ruby '1.9' do
|
5
|
+
context "A source file initialized with some coverage data" do
|
6
|
+
setup do
|
7
|
+
@source_file = SimpleCov::SourceFile.new(source_fixture('sample.rb'), [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil])
|
8
|
+
end
|
9
|
+
|
10
|
+
should "have a filename" do
|
11
|
+
assert @source_file.filename
|
12
|
+
end
|
13
|
+
|
14
|
+
should "have source equal to src" do
|
15
|
+
assert_equal @source_file.source, @source_file.src
|
16
|
+
end
|
17
|
+
|
18
|
+
should "have source_lines equal to lines" do
|
19
|
+
assert_equal @source_file.source_lines, @source_file.lines
|
20
|
+
end
|
21
|
+
|
22
|
+
should "have 10 source lines" do
|
23
|
+
assert_equal 10, @source_file.lines.count
|
24
|
+
end
|
25
|
+
|
26
|
+
should "have all source lines of type SimpleCov::SourceFile::Line" do
|
27
|
+
assert @source_file.lines.all? {|l| l.instance_of?(SimpleCov::SourceFile::Line)}
|
28
|
+
end
|
29
|
+
|
30
|
+
should "have 'class Foo' as line(2).source" do
|
31
|
+
assert_equal "class Foo\n", @source_file.line(2).source
|
32
|
+
end
|
33
|
+
|
34
|
+
should "return lines number 2, 3, 4, 7 for covered_lines" do
|
35
|
+
assert_equal [2, 3, 4, 7], @source_file.covered_lines.map(&:line)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "return lines number 8 for missed_lines" do
|
39
|
+
assert_equal [8], @source_file.missed_lines.map(&:line)
|
40
|
+
end
|
41
|
+
|
42
|
+
should "return lines number 1, 5, 6, 9, 10 for never_lines" do
|
43
|
+
assert_equal [1, 5, 6, 9, 10], @source_file.never_lines.map(&:line)
|
44
|
+
end
|
45
|
+
|
46
|
+
should "have 80% covered_percent" do
|
47
|
+
assert_equal 80.0, @source_file.covered_percent
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -1,110 +1,112 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestSourceFileLine < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
on_ruby '1.9' do
|
5
|
+
context "A source line" do
|
6
|
+
setup do
|
7
|
+
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
should 'return "# the ruby source" as src' do
|
11
|
+
assert_equal '# the ruby source', @line.src
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
should 'return the same for source as for src' do
|
15
|
+
assert_equal @line.src, @line.source
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
should 'have line number 5' do
|
19
|
+
assert_equal 5, @line.line_number
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
should 'have equal line_number, line and number' do
|
23
|
+
assert_equal @line.line_number, @line.line
|
24
|
+
assert_equal @line.line_number, @line.number
|
25
|
+
end
|
24
26
|
end
|
25
|
-
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
context "A source line with coverage" do
|
29
|
+
setup do
|
30
|
+
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
should "have coverage of 3" do
|
34
|
+
assert_equal 3, @line.coverage
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
should "be covered?" do
|
38
|
+
assert @line.covered?
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
should "not be never?" do
|
42
|
+
assert !@line.never?
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
should "not be missed?" do
|
46
|
+
assert !@line.missed?
|
47
|
+
end
|
46
48
|
end
|
47
|
-
end
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
context "A source line without coverage" do
|
51
|
+
setup do
|
52
|
+
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 0)
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
should "have coverage of 0" do
|
56
|
+
assert_equal 0, @line.coverage
|
57
|
+
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
should "not be covered?" do
|
60
|
+
assert !@line.covered?
|
61
|
+
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
should "not be never?" do
|
64
|
+
assert !@line.never?
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
67
|
+
should "be missed?" do
|
68
|
+
assert @line.missed?
|
69
|
+
end
|
68
70
|
end
|
69
|
-
end
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
context "A source line with no code" do
|
73
|
+
setup do
|
74
|
+
@line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, nil)
|
75
|
+
end
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
should "have nil coverage" do
|
78
|
+
assert_nil @line.coverage
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
should "not be covered?" do
|
82
|
+
assert !@line.covered?
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
should "be never?" do
|
86
|
+
assert @line.never?
|
87
|
+
end
|
87
88
|
|
88
|
-
|
89
|
-
|
89
|
+
should "not be missed?" do
|
90
|
+
assert !@line.missed?
|
91
|
+
end
|
90
92
|
end
|
91
|
-
end
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
should "raise ArgumentError when initialized with invalid src" do
|
95
|
+
assert_raise ArgumentError do
|
96
|
+
SimpleCov::SourceFile::Line.new(:symbol, 5, 3)
|
97
|
+
end
|
96
98
|
end
|
97
|
-
end
|
98
99
|
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
should "raise ArgumentError when initialized with invalid line_number" do
|
101
|
+
assert_raise ArgumentError do
|
102
|
+
SimpleCov::SourceFile::Line.new("some source", "five", 3)
|
103
|
+
end
|
102
104
|
end
|
103
|
-
end
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
106
|
+
should "raise ArgumentError when initialized with invalid coverage" do
|
107
|
+
assert_raise ArgumentError do
|
108
|
+
SimpleCov::SourceFile::Line.new("some source", 5, "three")
|
109
|
+
end
|
108
110
|
end
|
109
111
|
end
|
110
112
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 9
|
9
|
+
version: 0.3.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Christoph Olszowka
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-06 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -62,30 +62,15 @@ dependencies:
|
|
62
62
|
version: 2.0.0
|
63
63
|
type: :development
|
64
64
|
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: jeweler
|
67
|
-
prerelease: false
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
|
-
requirements:
|
71
|
-
- - "="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 1
|
75
|
-
- 4
|
76
|
-
- 0
|
77
|
-
version: 1.4.0
|
78
|
-
type: :development
|
79
|
-
version_requirements: *id004
|
80
65
|
description: Code coverage for Ruby 1.9 with a powerful configuration library and automatic merging of coverage across test suites
|
81
|
-
email:
|
66
|
+
email:
|
67
|
+
- christoph at olszowka de
|
82
68
|
executables: []
|
83
69
|
|
84
70
|
extensions: []
|
85
71
|
|
86
|
-
extra_rdoc_files:
|
87
|
-
|
88
|
-
- README.rdoc
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
89
74
|
files:
|
90
75
|
- .document
|
91
76
|
- .gitignore
|
@@ -95,7 +80,6 @@ files:
|
|
95
80
|
- LICENSE
|
96
81
|
- README.rdoc
|
97
82
|
- Rakefile
|
98
|
-
- VERSION
|
99
83
|
- lib/simplecov.rb
|
100
84
|
- lib/simplecov/adapters.rb
|
101
85
|
- lib/simplecov/command_guesser.rb
|
@@ -107,6 +91,7 @@ files:
|
|
107
91
|
- lib/simplecov/result.rb
|
108
92
|
- lib/simplecov/result_merger.rb
|
109
93
|
- lib/simplecov/source_file.rb
|
94
|
+
- lib/simplecov/version.rb
|
110
95
|
- simplecov.gemspec
|
111
96
|
- test/fixtures/app/controllers/sample_controller.rb
|
112
97
|
- test/fixtures/app/models/user.rb
|
@@ -118,6 +103,8 @@ files:
|
|
118
103
|
- test/fixtures/resultset2.rb
|
119
104
|
- test/fixtures/sample.rb
|
120
105
|
- test/helper.rb
|
106
|
+
- test/shoulda_macros.rb
|
107
|
+
- test/test_1_8_fallbacks.rb
|
121
108
|
- test/test_command_guesser.rb
|
122
109
|
- test/test_filters.rb
|
123
110
|
- test/test_merge_helpers.rb
|
@@ -130,8 +117,8 @@ homepage: http://github.com/colszowka/simplecov
|
|
130
117
|
licenses: []
|
131
118
|
|
132
119
|
post_install_message:
|
133
|
-
rdoc_options:
|
134
|
-
|
120
|
+
rdoc_options: []
|
121
|
+
|
135
122
|
require_paths:
|
136
123
|
- lib
|
137
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -152,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
139
|
version: "0"
|
153
140
|
requirements: []
|
154
141
|
|
155
|
-
rubyforge_project:
|
142
|
+
rubyforge_project: simplecov
|
156
143
|
rubygems_version: 1.3.7
|
157
144
|
signing_key:
|
158
145
|
specification_version: 3
|
@@ -168,6 +155,8 @@ test_files:
|
|
168
155
|
- test/fixtures/resultset2.rb
|
169
156
|
- test/fixtures/sample.rb
|
170
157
|
- test/helper.rb
|
158
|
+
- test/shoulda_macros.rb
|
159
|
+
- test/test_1_8_fallbacks.rb
|
171
160
|
- test/test_command_guesser.rb
|
172
161
|
- test/test_filters.rb
|
173
162
|
- test/test_merge_helpers.rb
|