jsinstrument 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -99,6 +99,7 @@ module JSInstrument
99
99
  # function coverage
100
100
  #
101
101
  if line and not instrumented_func_lines.member? line
102
+ # function declaration and anonymous function
102
103
  if ['FunctionDecl', 'FunctionExpr'].index node_classname
103
104
  if node.function_body
104
105
  insert_hitfunc_in node.function_body, line
@@ -110,8 +111,9 @@ module JSInstrument
110
111
  # branch coverage
111
112
  #
112
113
  if line and not instrumented_branch_lines.member? line
113
- if 'If' == parent_classname
114
- if 'Block' == node_classname
114
+ # if else
115
+ if 'Block' == node_classname
116
+ if 'If' == parent_classname
115
117
  if parent.value.eql? node
116
118
  instrumented_branch_lines.add line
117
119
  insert_hitbranch_in node
@@ -120,6 +122,14 @@ module JSInstrument
120
122
  insert_hitbranch_in node
121
123
  end
122
124
  end
125
+ # switch case
126
+ # CaseClause node has the same structure with BlockNode
127
+ # so we can share the instrument logic
128
+ elsif 'CaseClause' == node_classname
129
+ if node.value
130
+ instrumented_branch_lines.add line
131
+ insert_hitbranch_in node
132
+ end
123
133
  end
124
134
  end
125
135
  end
@@ -1,3 +1,3 @@
1
1
  module JSInstrument
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsinstrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: