Currently we have something like this:
TestCase HelloWorld do
Setup do
HelloWorld.new
end
Unit :hello => "aspect" do |hello_world|
...
end
end
This creates a "setup" and the return value of the setup procedure is passed to the unit test.
One of the features of KO that would be nice to see in Lemon is ok/no checks. These are calls that rerun a test passing
new arguments to it. In KO it look like this:
Test.case HelloWorld do
test "aspect" do |arg|
...
end
ok "arg"
no "arg"
end
We could move Lemon in that direction by simply adding ok/no methods, like so:
TestCase HelloWorld do
Unit :hello => "aspect" do |arg|
...
end
Ok "arg"
No "arg"
end
But then how does setup's return value come into play? Do we simple combine the arguments?
TestCase HelloWorld do
Setup do
HelloWorld.new
end
Unit :hello => "aspect" do |hello_world, arg|
...
end
Ok "arg"
No "arg"
end
First off, it may be very tricky to implment this combination, as currently it depends on arity == 0 or not as to whether setup's return value is passed, which would no longer work.
On second thought, the use of Ok/No style tests will often preclude the use of setup return value b/c the arguments are likely to define a new instance of the target class. Perhaps then setup should take the arg and pass any needed args on the the test method.
TestCase HelloWorld do
Setup do |arg1, arg2|
[ HelloWorld.new(arg1), arg2 ]
end
Unit :hello => "aspect" do |hello_world, arg2|
...
end
Ok "arg1", "arg2"
No "arg1", "arg2"
end
If there is no setup method, then the args are passed directly to the unit test.
It seems a bit strange but it is clearly the corrent arrangement.
Currently we have something like this:
This creates a "setup" and the return value of the setup procedure is passed to the unit test.
One of the features of KO that would be nice to see in Lemon is ok/no checks. These are calls that rerun a test passing
new arguments to it. In KO it look like this:
We could move Lemon in that direction by simply adding ok/no methods, like so:
But then how does setup's return value come into play? Do we simple combine the arguments?
First off, it may be very tricky to implment this combination, as currently it depends on arity == 0 or not as to whether setup's return value is passed, which would no longer work.
On second thought, the use of Ok/No style tests will often preclude the use of setup return value b/c the arguments are likely to define a new instance of the target class. Perhaps then setup should take the arg and pass any needed args on the the test method.
If there is no setup method, then the args are passed directly to the unit test.
It seems a bit strange but it is clearly the corrent arrangement.