Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed more tests

[git-p4: depot-paths = "//src/heckle/dev/": change = 3479]
  • Loading branch information...
commit 6a1585954c14c4ac1ec50a0d64f48713289e66a5 1 parent c8eb983
@zenspider zenspider authored
Showing with 37 additions and 4 deletions.
  1. +1 −1  lib/heckle.rb
  2. +36 −3 test/test_heckle.rb
View
2  lib/heckle.rb
@@ -231,7 +231,7 @@ def process_call(exp)
mutate_node out
else
increment_node_count out
- increment_mutation_count out if should_heckle? out
+ increment_mutation_count out if should_heckle? out
out
end
end
View
39 test/test_heckle.rb
@@ -289,6 +289,11 @@ def util_expected(n = nil)
end
class TestHeckleIf < HeckleTestCase
+ def setup
+ @nodes = s(:if)
+ super
+ end
+
def test_default_structure
expected = s(:defn, :uses_if,
s(:args),
@@ -367,6 +372,11 @@ def test_should_flip_true_to_false_and_false_to_true
end
class TestHeckleWhile < HeckleTestCase
+ def setup
+ @nodes = s(:while)
+ super
+ end
+
def test_default_structure
expected = s(:defn, :uses_while,
s(:args),
@@ -390,6 +400,11 @@ def test_flips_while_to_until
end
class TestHeckleUntil < HeckleTestCase
+ def setup
+ @nodes = s(:until)
+ super
+ end
+
def test_default_structure
expected = s(:defn, :uses_until,
s(:args),
@@ -421,7 +436,11 @@ def test_call_deleted
s(:block,
s(:nil))))
- @heckler.process(@heckler.current_tree)
+ @heckler.process(@heckler.current_tree) # some_func
+ @heckler.reset_tree
+ @heckler.process(@heckler.current_tree) # some_other_func
+ @heckler.reset_tree
+ @heckler.process(@heckler.current_tree) # +
assert_equal expected, @heckler.current_tree
end
@@ -447,17 +466,31 @@ def setup
super
end
+ def test_default_structure
+ expected = s(:defn, :uses_callblock,
+ s(:args),
+ s(:scope,
+ s(:block,
+ s(:iter,
+ s(:call, s(:call, nil, :x, s(:arglist)), :y, s(:arglist)),
+ nil,
+ s(:lit, 1)))))
+
+ assert_equal :foo, @heckler.current_tree
+ end
def test_callblock_deleted
expected = s(:defn, :uses_callblock,
s(:args),
s(:scope,
s(:block,
- s(:iter, s(:call, s(:call, nil, :x, s(:arglist)), :y), nil, s(:lit, 1)))))
+ s(:iter,
+ s(:call, s(:call, nil, :x, s(:arglist)), :y),
+ nil,
+ s(:lit, 1)))))
@heckler.process(@heckler.current_tree)
assert_equal expected, @heckler.current_tree
end
-
end
class TestHeckleClassMethod < Test::Unit::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.