]> source.dussan.org Git - rspamd.git/commitdiff
Fix closure lifetime in tests.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Apr 2015 15:12:29 +0000 (16:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Apr 2015 15:12:29 +0000 (16:12 +0100)
test/lua/unit/url.lua

index 6d09fcb3f31bb72ca3dbab9e92fb81b721060cdf..d56d064050db129471a5e41d27609b0a36d05914 100644 (file)
@@ -10,12 +10,12 @@ context("URL check functions", function()
   unsigned ottery_rand_range(unsigned top);
   ]]
   
-  local pool = mpool.create()
   local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
 
   ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat"))
 
   test("Extract urls from text", function()
+    local pool = mpool.create()
     local cases = {
       {"test.com text", {"test.com", nil}},
       {"test.com. text", {"test.com", nil}},
@@ -45,7 +45,7 @@ context("URL check functions", function()
         assert_equal(c[2][2], t['user'])
       end
     end
+    pool:destroy()
   end)
   
-  pool:destroy()
 end)
\ No newline at end of file