change test framework to use files for in and out (s-exp)

This commit is contained in:
Torsten Ruger
2015-09-18 21:55:02 +03:00
parent 396a843a5e
commit 22e3c59674
80 changed files with 946 additions and 13 deletions

View File

@ -0,0 +1,10 @@
class Foo < Object
ofthen(3 , var)
end
-- -- --
s(:list, [s(:class, "Foo",
s(:module, "Object"), [s(:call,
s(:name, "ofthen"),
s(:arguments,
s(:int, 3),
s(:name, "var")))])])

View File

@ -0,0 +1,18 @@
class Pifi
ofthen(3 , var)
int ofthen(int n , ref m)
44
end
end
-- -- --
s(:list, [s(:class, "Pifi", nil, [s(:call,
s(:name, "ofthen"),
s(:arguments,
s(:int, 3),
s(:name, "var"))), s(:function, :int,
s(:name, "ofthen"),
s(:parameters,
s(:field, :int, :n),
s(:field, :ref, :m)),
s(:expressions,
s(:int, 44)))])])

View File

@ -0,0 +1,25 @@
class Ifi
int ofthen(int n)
if(0)
isit = 42
else
maybenot = 667
end
end
end
-- -- --
s(:list, [s(:class, "Ifi", nil, [s(:function, :int,
s(:name, "ofthen"),
s(:parameters,
s(:field, :int, :n)),
s(:expressions,
s(:if,
s(:condition,
s(:int, 0)),
s(:if_true,
s(:assign,
s(:name, "isit"),
s(:int, 42))),
s(:if_false, [s(:assign,
s(:name, "maybenot"),
s(:int, 667))]))))])])

View File

@ -0,0 +1,7 @@
class Foo < Object
int Foo.test()
43
end
end
-- -- --
{:expression_list=>[{:module_name=>"Foo", :derived_name=>s(:module, "Object"), :class_expressions=>[{:type=>"int", :receiver=>s(:module, "Foo"), :function_name=>s(:name, "test"), :parameter_list=>[], :expressions=>[s(:int, 43)], :end=>"end"}], :end=>"end"}]}

View File

@ -0,0 +1,11 @@
class Foo
module Boo
funcall(3 , var)
end
end
-- -- --
s(:list, [s(:class, "Foo", nil, [s(:module, "Boo", [s(:call,
s(:name, "funcall"),
s(:arguments,
s(:int, 3),
s(:name, "var")))])])])

View File

@ -0,0 +1,19 @@
class Opers
int foo(int x)
int abba = 5
abba + 5
end
end
-- -- --
s(:list, [s(:class, "Opers", nil, [s(:function, :int,
s(:name, "foo"),
s(:parameters,
s(:field, :int, :x)),
s(:expressions,
s(:name, "int"),
s(:assign,
s(:name, "abba"),
s(:int, 5)),
s(:operator, "+",
s(:name, "abba"),
s(:int, 5))))])])

View File

@ -0,0 +1,5 @@
class Foo
5
end
-- -- --
s(:list, [s(:class, "Foo", nil, [s(:int, 5)])])