Skip to content

Commit

Permalink
tests: remove test databases after tests
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 666b517269a29bae8281e412f0892ec7a1b53b19ce16b68b6aa1745e73e4fe4c
  • Loading branch information
thindil committed Jun 22, 2024
1 parent 42202dc commit a2c4694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions tests/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@

import std/paths
import utils/utils
import ../src/[db, history]
import ../src/history
import unittest2
include ../src/options

suite "Unit tests for options module":

checkpoint "Initializing the tests"
let db: DbConn = initDb(dbName = "test11.db".Path)
const dbName: Path = "test11.db".Path
let db: DbConn = initDb(dbName = dbName)
var commands: ref Table[string, CommandData] = newTable[string, CommandData]()
discard initHistory(db = db, commands = commands)

Expand Down Expand Up @@ -97,4 +98,4 @@ suite "Unit tests for options module":
to(dbVal = text.dbValue, T = OptionValType) == text

suiteTeardown:
closeDb(returnCode = QuitSuccess.ResultCode, db = db)
removeDb(dbName = dbName, db = db)
6 changes: 3 additions & 3 deletions tests/output.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import std/paths
when defined(testInput):
import std/tables
import utils/utils
import ../src/db
import unittest2
include ../src/output

suite "Unit tests for output module":

checkpoint "Initializing the tests"
let db: DbConn = initDb(dbName = "test12.db".Path)
const dbName: Path = "test12.db".Path
let db: DbConn = initDb(dbName = dbName)

test "Showing an error message":
check:
Expand Down Expand Up @@ -67,4 +67,4 @@ suite "Unit tests for output module":
showFormPrompt(prompt = "Form prompt", db = db)

suiteTeardown:
closeDb(returnCode = QuitSuccess.ResultCode, db = db)
removeDb(dbName = dbName, db = db)

0 comments on commit a2c4694

Please sign in to comment.