simplecov 0.3.7 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- context "Inside fixtures/frameworks" do
7
- setup do
8
- @current_dir = Dir.getwd
9
- Dir.chdir(File.join(File.dirname(__FILE__), 'fixtures', 'frameworks'))
10
- FileUtils.rm_rf('./coverage')
11
- end
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
- should "have return code 0 when running testunit_good.rb" do
14
- `ruby testunit_good.rb`
15
- assert_equal 0, $?.exitstatus
16
- end
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
- should "have return code 0 when running rspec_good.rb" do
19
- `rspec rspec_good.rb`
20
- assert_equal 0, $?.exitstatus
21
- end
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
- should "have return code 1 when running testunit_bad.rb" do
24
- `ruby testunit_bad.rb`
25
- assert_equal 1, $?.exitstatus
26
- end
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
- should "have return code 1 when running rspec_bad.rb" do
29
- `rspec rspec_bad.rb`
30
- assert_equal 1, $?.exitstatus
31
- end
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
- teardown do
34
- Dir.chdir(@current_dir)
34
+ teardown do
35
+ Dir.chdir(@current_dir)
36
+ end
35
37
  end
36
38
  end
37
39
  end
@@ -1,49 +1,51 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestSourceFile < Test::Unit::TestCase
4
- context "A source file initialized with some coverage data" do
5
- setup do
6
- @source_file = SimpleCov::SourceFile.new(source_fixture('sample.rb'), [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil])
7
- end
8
-
9
- should "have a filename" do
10
- assert @source_file.filename
11
- end
12
-
13
- should "have source equal to src" do
14
- assert_equal @source_file.source, @source_file.src
15
- end
16
-
17
- should "have source_lines equal to lines" do
18
- assert_equal @source_file.source_lines, @source_file.lines
19
- end
20
-
21
- should "have 10 source lines" do
22
- assert_equal 10, @source_file.lines.count
23
- end
24
-
25
- should "have all source lines of type SimpleCov::SourceFile::Line" do
26
- assert @source_file.lines.all? {|l| l.instance_of?(SimpleCov::SourceFile::Line)}
27
- end
28
-
29
- should "have 'class Foo' as line(2).source" do
30
- assert_equal "class Foo\n", @source_file.line(2).source
31
- end
32
-
33
- should "return lines number 2, 3, 4, 7 for covered_lines" do
34
- assert_equal [2, 3, 4, 7], @source_file.covered_lines.map(&:line)
35
- end
36
-
37
- should "return lines number 8 for missed_lines" do
38
- assert_equal [8], @source_file.missed_lines.map(&:line)
39
- end
40
-
41
- should "return lines number 1, 5, 6, 9, 10 for never_lines" do
42
- assert_equal [1, 5, 6, 9, 10], @source_file.never_lines.map(&:line)
43
- end
44
-
45
- should "have 80% covered_percent" do
46
- assert_equal 80.0, @source_file.covered_percent
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
- context "A source line" do
5
- setup do
6
- @line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
7
- end
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
- should 'return "# the ruby source" as src' do
10
- assert_equal '# the ruby source', @line.src
11
- end
10
+ should 'return "# the ruby source" as src' do
11
+ assert_equal '# the ruby source', @line.src
12
+ end
12
13
 
13
- should 'return the same for source as for src' do
14
- assert_equal @line.src, @line.source
15
- end
14
+ should 'return the same for source as for src' do
15
+ assert_equal @line.src, @line.source
16
+ end
16
17
 
17
- should 'have line number 5' do
18
- assert_equal 5, @line.line_number
19
- end
18
+ should 'have line number 5' do
19
+ assert_equal 5, @line.line_number
20
+ end
20
21
 
21
- should 'have equal line_number, line and number' do
22
- assert_equal @line.line_number, @line.line
23
- assert_equal @line.line_number, @line.number
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
- context "A source line with coverage" do
28
- setup do
29
- @line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 3)
30
- end
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
- should "have coverage of 3" do
33
- assert_equal 3, @line.coverage
34
- end
33
+ should "have coverage of 3" do
34
+ assert_equal 3, @line.coverage
35
+ end
35
36
 
36
- should "be covered?" do
37
- assert @line.covered?
38
- end
37
+ should "be covered?" do
38
+ assert @line.covered?
39
+ end
39
40
 
40
- should "not be never?" do
41
- assert !@line.never?
42
- end
41
+ should "not be never?" do
42
+ assert !@line.never?
43
+ end
43
44
 
44
- should "not be missed?" do
45
- assert !@line.missed?
45
+ should "not be missed?" do
46
+ assert !@line.missed?
47
+ end
46
48
  end
47
- end
48
49
 
49
- context "A source line without coverage" do
50
- setup do
51
- @line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, 0)
52
- end
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
- should "have coverage of 0" do
55
- assert_equal 0, @line.coverage
56
- end
55
+ should "have coverage of 0" do
56
+ assert_equal 0, @line.coverage
57
+ end
57
58
 
58
- should "not be covered?" do
59
- assert !@line.covered?
60
- end
59
+ should "not be covered?" do
60
+ assert !@line.covered?
61
+ end
61
62
 
62
- should "not be never?" do
63
- assert !@line.never?
64
- end
63
+ should "not be never?" do
64
+ assert !@line.never?
65
+ end
65
66
 
66
- should "be missed?" do
67
- assert @line.missed?
67
+ should "be missed?" do
68
+ assert @line.missed?
69
+ end
68
70
  end
69
- end
70
71
 
71
- context "A source line with no code" do
72
- setup do
73
- @line = SimpleCov::SourceFile::Line.new('# the ruby source', 5, nil)
74
- end
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
- should "have nil coverage" do
77
- assert_nil @line.coverage
78
- end
77
+ should "have nil coverage" do
78
+ assert_nil @line.coverage
79
+ end
79
80
 
80
- should "not be covered?" do
81
- assert !@line.covered?
82
- end
81
+ should "not be covered?" do
82
+ assert !@line.covered?
83
+ end
83
84
 
84
- should "be never?" do
85
- assert @line.never?
86
- end
85
+ should "be never?" do
86
+ assert @line.never?
87
+ end
87
88
 
88
- should "not be missed?" do
89
- assert !@line.missed?
89
+ should "not be missed?" do
90
+ assert !@line.missed?
91
+ end
90
92
  end
91
- end
92
93
 
93
- should "raise ArgumentError when initialized with invalid src" do
94
- assert_raise ArgumentError do
95
- SimpleCov::SourceFile::Line.new(:symbol, 5, 3)
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
- should "raise ArgumentError when initialized with invalid line_number" do
100
- assert_raise ArgumentError do
101
- SimpleCov::SourceFile::Line.new("some source", "five", 3)
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
- should "raise ArgumentError when initialized with invalid coverage" do
106
- assert_raise ArgumentError do
107
- SimpleCov::SourceFile::Line.new("some source", 5, "three")
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
- - 7
9
- version: 0.3.7
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: 2010-11-06 00:00:00 +01:00
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: christoph at olszowka de
66
+ email:
67
+ - christoph at olszowka de
82
68
  executables: []
83
69
 
84
70
  extensions: []
85
71
 
86
- extra_rdoc_files:
87
- - LICENSE
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
- - --charset=UTF-8
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