Added tearDown method to the test suites.
This commit is contained in:
parent
f81d4da4fa
commit
80e8a1c8c5
3 changed files with 59 additions and 12 deletions
13
test.nim
13
test.nim
|
|
@ -10,9 +10,11 @@ testSuite UnitTests:
|
|||
self.assertTrue(self.testObj == 400)
|
||||
|
||||
method setup()=
|
||||
self.testObj = 5
|
||||
self.testObj = 90
|
||||
|
||||
method tearDown()=
|
||||
self.testObj = 0
|
||||
|
||||
method testForB()=
|
||||
var b = 0
|
||||
self.doThings()
|
||||
|
|
@ -29,9 +31,11 @@ testSuite UnitTestsNew:
|
|||
testObj: int
|
||||
|
||||
method setup()=
|
||||
self.testObj = 5
|
||||
self.testObj = 90
|
||||
|
||||
method tearDown()=
|
||||
self.testObj = 0
|
||||
|
||||
method testTestObj()=
|
||||
self.assertTrue(self.testObj == 90)
|
||||
|
||||
|
|
@ -76,6 +80,11 @@ testSuite MoreInheritance of TestInherit:
|
|||
# fail. This is expected.
|
||||
self.testObj = 12345
|
||||
|
||||
method tearDown()=
|
||||
# Calling the direct parent's tearDown method
|
||||
self.tearDownTestInherit()
|
||||
self.testObj = 0
|
||||
|
||||
method testTestObj()=
|
||||
# This method is overwritten. To call the base method,
|
||||
# simply use
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue