Sha256: 4f448907ce481b2ec41470fdc7ca81ee7c557c4586cad820586554c69339da41

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

require 'spec_helper'

describe 'WhileRewriter' do
  include TrackWhiles, DoRewrite

  before :each do
    @while_user = WhileUser.new 10
    @methods = sexpify_instance_methods WhileUser
    @while_rewriter = VirtualKeywords::WhileRewriter.new

    @my_while_calls = 0

    VirtualKeywords::REWRITTEN_KEYWORDS.register_lambda_for_object(
        @while_user, :while, my_while)
  end

  def rewriters
    [@while_rewriter]
  end
 
  it 'rewrites "while" expressions' do
    do_rewrite(:while_count_to_value, @while_user) 
    @my_while_calls.should eql 1
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
virtual_keywords-0.3.1 lib/spec/while_rewriter_spec.rb
virtual_keywords-0.3.0 lib/spec/while_rewriter_spec.rb
virtual_keywords-0.1.0 lib/spec/while_rewriter_spec.rb