function Option:test()
return true
end
That makes the test pass again. Of course, if I hardcode the return value to false it will fail. We could test that, but there's an easier way to make sure the function is called:
assert_true(userdata.flag)
And that fails:
2) Error! (narrator_tests.test_option_func1):
test_narrator.lua:701: attempt to index global 'userdata' (a nil value)
test_narrator.lua:701: in function <test_narrator.lua:671>
Interesting: userdata is not set. Stands to reason, it would normally be supplied by Narrator, and we're not using that class in this test.
So, we need a table called userdata, and we need pass that into the test method. Actually, let's call it something else, just so we know it's not picking the table up as a global
--
-- test the condition
--
local ud = {}
rc = option.test(ud)
assert_true(rc)
assert_true(userdata.flag)
Still won't work since Option:test is just a stub. Time to fix that, I think.
No comments:
Post a Comment