bashcov 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a38548d5c6225411e74a70bc3de2982531e83d15
4
- data.tar.gz: b8df3975562e21dbbd9acde6fa4413d79d0197ab
3
+ metadata.gz: 846ded19c1d2718bb704f9d34c0485a54d5c351f
4
+ data.tar.gz: 7d7df456bc41ca13253315e104d233879483b9da
5
5
  SHA512:
6
- metadata.gz: 0aac1da4bfb28a0edab21b6bf1c02bd2215a8d301176d005436b92da6f1c5b7a03c19aa60b3ad5ff88fa9e72e3029a4f5734b39ce41e6dc70ae6f66de8495163
7
- data.tar.gz: 46decd7f48918f1e57af03033aecaaac8f3d761e8904458ce3c3acb95b1ad91d171853d2d57f5213419ea514722a946dc29d8ed98fd2a0dd79a824a48cac84e0
6
+ metadata.gz: 85f015eb2308cfe698de95a59ce6f4decc37f81ba78a4de40fc617d7c0f156d9074f6072fd0b5cf8dac327c90f3660aa0c9cedc4a1475753211fe853d23e8a55
7
+ data.tar.gz: 9bded014137b9d94f5583b4921a77b22530c7f65a8e492b2fe0c8f922c265e2d4aac5c2bbbbe2ba03b92628b097558f65914fb2cf5a6177fde2fbe9d78122cca
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
- ## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.4.0...master))
1
+ ## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v1.4.1...master))
2
2
 
3
3
  * TBD
4
4
 
5
+ ## v1.4.1, 2016-10-11 ([changes](https://github.com/infertux/bashcov/compare/v1.4.0...v1.4.1))
6
+
7
+ * [BUGFIX] Fix incorrect coverage for some multiline strings (#22)
8
+
5
9
  ## v1.4.0, 2016-10-08 ([changes](https://github.com/infertux/bashcov/compare/v1.3.1...v1.4.0))
6
10
 
7
11
  * [BUGFIX] Fix incorrect coverage for case statements (#21)
@@ -30,7 +34,7 @@
30
34
 
31
35
  ## v1.2.1, 2015-05-05 ([changes](https://github.com/infertux/bashcov/compare/v1.2.0...v1.2.1))
32
36
 
33
- * [BUGFIX] Preserve original exit status when exiting Bashcov
37
+ * [BUGFIX] Preserve original exit status when exiting Bashcov
34
38
 
35
39
  ## v1.2.0, 2015-05-04 ([changes](https://github.com/infertux/bashcov/compare/v1.1.0...v1.2.0))
36
40
 
@@ -44,8 +48,8 @@
44
48
 
45
49
  ## v1.0.1, 2013-03-21 ([changes](https://github.com/infertux/bashcov/compare/v1.0.0...v1.0.1))
46
50
 
47
- * [BUGFIX] Allow to add SimpleCov filters
48
- * [BUGFIX] Lines containing only `elif` should be ignored
51
+ * [BUGFIX] Allow to add SimpleCov filters
52
+ * [BUGFIX] Lines containing only `elif` should be ignored
49
53
 
50
54
  ## v1.0.0, 2013-03-16 ([changes](https://github.com/infertux/bashcov/compare/v0.0.9...v1.0.0))
51
55
 
data/lib/bashcov/lexer.rb CHANGED
@@ -34,7 +34,8 @@ module Bashcov
34
34
 
35
35
  lines.each_with_index do |line, lineno|
36
36
  mark_multiline(lines, lineno, /\A[^\n]+<<-?'?(\w+)'?\s*$.*\1/m) # heredoc
37
- mark_multiline(lines, lineno, /\A[^\n]+\\$(\s*['"][^'"]*['"]\s*\\$){1,}\s*['"][^'"]*['"]\s*$/) # multiline string
37
+ mark_multiline(lines, lineno, /\A[^\n]+\\$(\s*['"][^'"]*['"]\s*\\$){1,}\s*['"][^'"]*['"]\s*$/) # multiline string concatenated with backslashes
38
+ mark_multiline(lines, lineno, /\A[^\n]+\s+(['"])[^'"]*\1/m, forward: false) # multiline string concatenated with newlines
38
39
 
39
40
  mark_line(line, lineno)
40
41
  end
@@ -42,14 +43,18 @@ module Bashcov
42
43
 
43
44
  private
44
45
 
45
- def mark_multiline(lines, lineno, regexp)
46
+ def mark_multiline(lines, lineno, regexp, forward: true)
46
47
  seek_forward = lines[lineno..-1].join
47
48
  return unless (multiline_match = seek_forward.match(regexp))
48
49
 
49
50
  length = multiline_match.to_s.count($/)
50
- (lineno + 1).upto(lineno + length).each do |sub_lineno|
51
- # mark subsequent lines with the same coverage as the first line
52
- @coverage[sub_lineno] = @coverage[lineno]
51
+ first, last = lineno + 1, lineno + length
52
+ range = (forward ? first.upto(last) : (last - 1).downto(first - 1))
53
+ reference_lineno = (forward ? first - 1 : last)
54
+
55
+ range.each do |sub_lineno|
56
+ # mark related lines with the same coverage as the reference line
57
+ @coverage[sub_lineno] = @coverage[reference_lineno]
53
58
  end
54
59
  end
55
60
 
@@ -3,5 +3,5 @@
3
3
  # :nodoc:
4
4
  module Bashcov
5
5
  # Current Bashcov version
6
- VERSION = "1.4.0".freeze
6
+ VERSION = "1.4.1".freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bashcov
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cédric Félizard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-08 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov