lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi guys,

I have another newbie question this time on unit testing.

I am trying to use lunit and I am having a problem with this code:

require "lunit"
require "log"
print("Starting testing of log lib ...");

module( "log_tests", lunit.testcase )

function test_loglib()
  assert_true(log ~= nil, "Log object must be defined!")
assert_true(type(log.debug) == "function", "log.debug method must exist!")
end

it blows up:

gs@flipper:~/Lua/mystuff/db/files$ lunit ../../tests/log_tests.lua
Starting testing of log lib ...
Loaded testsuite with 1 tests in 1 testcases.

    F

1 Assertions checked.

  1) Failure (log_tests.test_loglib):
../../tests/log_tests.lua:8: true expected but was false
../../tests/log_tests.lua:8: Log object must be defined!

It seems that I cannot require my own package and use my methods from it... what I am doing wrong any clues?? I tried reading the examples but there is nothing which requires an external module? Looked also on luaforge at the other unit testing lib luaunit and it also has very basic examples.

TIA
/george