Debian Codegraph @

tests/config/tapered/test/dynamic-setup-teardown-test.lua

raw
1 package.path = '../src/?.lua;' .. package.path
2 local tap = require 'tapered'
3
4 -- luacheck: globals setup teardown
5 function setup()
6 print("# I'm a little teapot.")
7 end
8 tap.ok(true, "setup() only with '# I'm a little teapot.'")
9
10 function setup()
11 print('# This is my handle and this is my spout.')
12 end
13 function teardown()
14 print('# Cleanup on aisle 9!')
15 end
16 tap.ok(true, 'setup() handle and spout, teardown() cleanup on aisle 9')
17
18 function teardown()
19 print('# I changed this.')
20 end
21 tap.ok(true, 'setup() again handle and spout, teardown() changed')
22
23 setup = nil
24 teardown = nil
25 tap.ok(true, 'Both setup and teardown should be gone now: redefined as nil.')
26
27 tap.done()