more class function testing

This commit is contained in:
Torsten Ruger 2015-11-07 00:13:57 +02:00
parent 46e1a112ab
commit 42c404802d
3 changed files with 56 additions and 2 deletions

View File

@ -8,3 +8,4 @@ require_relative "test_putint"
require_relative "test_recursive_fibo"
require_relative "test_return"
require_relative "test_while_fibo"
require_relative "test_word"

View File

@ -29,7 +29,37 @@ class Object
end
end
HERE
@length = 486
check_return 80
@length = 486
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
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

View 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