Permalink
Browse files

better test for end of loop

  • Loading branch information...
1 parent a435598 commit 7cfb8fb9d33306a15968a97f55356c371535fbcc @steveklabnik committed Dec 9, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 test/interpreter_test.rb
@@ -65,8 +65,10 @@ def test_eval_loop_node
end
def test_eval_end_loop_node
- # so we enter the loop
+ # so we loop twice
ast = [Mojikun::ThumbsUpNode.new,
+ Mojikun::ThumbsUpNode.new,
+
Mojikun::LoopNode.new,
# move right once, increment, move left
@@ -76,14 +78,15 @@ def test_eval_end_loop_node
# decrement so we leave the loop
Mojikun::ThumbsDownNode.new,
+
Mojikun::EndLoopNode.new,
# move right so we can see the 1 we did in the loop
Mojikun::PointRightNode.new,
]
@interpreter.evaluate(ast)
- assert_equal 1, @interpreter.runtime.current_data
+ assert_equal 2, @interpreter.runtime.current_data
end
def test_loop_map

0 comments on commit 7cfb8fb

Please sign in to comment.