deprecating ruby package
to be replaced by vool and mom
This commit is contained in:
37
stash/test_rubyx/passes/test_locals_collector.rb
Normal file
37
stash/test_rubyx/passes/test_locals_collector.rb
Normal file
@ -0,0 +1,37 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Rubyx
|
||||
module Passes
|
||||
class TestLocalsCollector #< MiniTest::Test
|
||||
|
||||
def setup
|
||||
Risc.machine.boot unless Risc.machine.booted
|
||||
end
|
||||
|
||||
def parse_collect( input )
|
||||
ast = Parser::Ruby22.parse input
|
||||
LocalsCollector.new.collect(ast)
|
||||
end
|
||||
|
||||
def test_no_locals
|
||||
locals = parse_collect "def meth; end"
|
||||
assert locals.empty?
|
||||
end
|
||||
|
||||
def test_method_is_not_local
|
||||
locals = parse_collect("def meth2(arg1); foo ;end")
|
||||
assert locals.empty?
|
||||
end
|
||||
|
||||
def test_local_assign_one
|
||||
locals = parse_collect("def meth2(arg1); foo = bar ;end")
|
||||
assert locals[:foo] , locals.inspect
|
||||
end
|
||||
def test_local_assign_two
|
||||
locals = parse_collect("def meth2(arg1); foo = bar ; groove = 1 + 2 ;end")
|
||||
assert locals.length == 2 , locals.inspect
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user