fix interpreter to output symbols
which amazingly lets us get at classnames etc
This commit is contained in:
18
test/mains/source/classname_Space_5.rb
Normal file
18
test/mains/source/classname_Space_5.rb
Normal file
@ -0,0 +1,18 @@
|
||||
class Class
|
||||
def name
|
||||
@name
|
||||
end
|
||||
end
|
||||
class Type
|
||||
def name
|
||||
@object_class.name
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def type
|
||||
@type
|
||||
end
|
||||
def main(arg)
|
||||
type.name.putstring
|
||||
end
|
||||
end
|
@ -16,21 +16,19 @@ module Mains
|
||||
|
||||
def whole_input
|
||||
<<-eos
|
||||
class Space
|
||||
def times
|
||||
n = 5
|
||||
i = 0
|
||||
while( i < 5 )
|
||||
yield
|
||||
i = i + 1
|
||||
end
|
||||
return 1
|
||||
class Class
|
||||
def get_name
|
||||
@name
|
||||
end
|
||||
end
|
||||
class Type
|
||||
def get_name
|
||||
@object_class.get_name
|
||||
end
|
||||
end
|
||||
class Space
|
||||
def main(arg)
|
||||
times{
|
||||
"1".putstring
|
||||
}
|
||||
return 4
|
||||
@type.get_name.putstring
|
||||
end
|
||||
end
|
||||
eos
|
||||
@ -43,8 +41,8 @@ module Mains
|
||||
def test_chain
|
||||
run_all
|
||||
assert_equal ::Integer , get_return.class , " "
|
||||
assert_equal 4 , get_return , " "
|
||||
assert_equal "11111" , @interpreter.stdout
|
||||
#assert_equal 4 , get_return , " "
|
||||
assert_equal "hi" , @interpreter.stdout
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user