Rapid spam filtering system https://rspamd.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
694 B

  1. context("Logger unit tests", function()
  2. test("Logger functions", function()
  3. local log = require "rspamd_logger"
  4. local cases = {
  5. {'string', 'string'},
  6. {'%1', 'string', 'string'},
  7. {'%1', '1.1', 1.1},
  8. {'%1', '1', 1},
  9. {'%1', 'true', true},
  10. {'%1', '{[1] = 1, [2] = test}', {1, 'test'}},
  11. {'%1', '{[1] = 1, [2] = 2.1, [k2] = test}', {1, 2.1, k2='test'}},
  12. {'%s', 'true', true},
  13. }
  14. for _,c in ipairs(cases) do
  15. local s
  16. if c[3] then
  17. s = log.slog(c[1], c[3])
  18. else
  19. s = log.slog(c[1])
  20. end
  21. assert_equal(s, c[2], string.format("'%s' doesn't match with '%s'",
  22. c[2], s))
  23. end
  24. end)
  25. end)