Prevent Busted from blowing up on cdata finalizers by properly closing

opened documents...
This commit is contained in:
NiLuJe
2020-12-19 05:32:23 +01:00
parent 0ab4023150
commit 9cda84ef2f
16 changed files with 155 additions and 20 deletions

View File

@@ -12,9 +12,9 @@ describe("Readersearch module", function()
end)
describe("search API for EPUB documents", function()
local doc, search, rolling
local readerui, doc, search, rolling
setup(function()
local readerui = ReaderUI:new{
readerui = ReaderUI:new{
dimen = Screen:getSize(),
document = DocumentRegistry:openDocument(sample_epub),
}
@@ -22,6 +22,10 @@ describe("Readersearch module", function()
search = readerui.search
rolling = readerui.rolling
end)
teardown(function()
readerui:closeDocument()
readerui:onClose()
end)
it("should search backward", function()
rolling:onGotoPage(10)
assert.truthy(search:searchFromCurrent("Verona", 1))
@@ -117,9 +121,9 @@ describe("Readersearch module", function()
end)
describe("search API for PDF documents", function()
local doc, search, paging
local readerui, doc, search, paging
setup(function()
local readerui = ReaderUI:new{
readerui = ReaderUI:new{
dimen = Screen:getSize(),
document = DocumentRegistry:openDocument(sample_pdf),
}
@@ -127,6 +131,10 @@ describe("Readersearch module", function()
search = readerui.search
paging = readerui.paging
end)
teardown(function()
readerui:closeDocument()
readerui:onClose()
end)
it("should match single word with case insensitive option in one page", function()
assert.are.equal(9, #doc.koptinterface:findAllMatches(doc, "what", true, 20))
assert.are.equal(51, #doc.koptinterface:findAllMatches(doc, "the", true, 20))