more class function testing
This commit is contained in:
parent
46e1a112ab
commit
42c404802d
@ -8,3 +8,4 @@ require_relative "test_putint"
|
|||||||
require_relative "test_recursive_fibo"
|
require_relative "test_recursive_fibo"
|
||||||
require_relative "test_return"
|
require_relative "test_return"
|
||||||
require_relative "test_while_fibo"
|
require_relative "test_while_fibo"
|
||||||
|
require_relative "test_word"
|
||||||
|
@ -29,7 +29,37 @@ class Object
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@length = 486
|
@length = 486
|
||||||
check_return 80
|
check_return 80
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_class_method
|
||||||
|
@string_input = <<HERE
|
||||||
|
class Object
|
||||||
|
|
||||||
|
int self.some()
|
||||||
|
return 5
|
||||||
|
end
|
||||||
|
|
||||||
|
int main()
|
||||||
|
return Object.some()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
HERE
|
||||||
|
@length = 36
|
||||||
|
check_return 5
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_class_method_fails
|
||||||
|
@string_input = <<HERE
|
||||||
|
class Object
|
||||||
|
int main()
|
||||||
|
return Object.som()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
HERE
|
||||||
|
assert_raises {check}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
23
test/compiler/fragments/test_word.rb
Normal file
23
test/compiler/fragments/test_word.rb
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
require_relative 'helper'
|
||||||
|
|
||||||
|
class TestWord < MiniTest::Test
|
||||||
|
include Fragments
|
||||||
|
|
||||||
|
def test_hello
|
||||||
|
@string_input = <<HERE
|
||||||
|
class Object
|
||||||
|
Word self.new()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
class Object
|
||||||
|
int main()
|
||||||
|
Word w = Word.new()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
HERE
|
||||||
|
@length = 37
|
||||||
|
@stdout = ""
|
||||||
|
check
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user