|
1 | 1 | #!/usr/bin/env tarantool |
2 | 2 | local test = require('tap').test() |
3 | | -test:plan(2) |
| 3 | +test:plan(3) |
4 | 4 |
|
5 | 5 | local test_user = 'test' |
6 | 6 | local test_pass = '1234' |
@@ -111,6 +111,37 @@ test:test('check for call grants', function(test) |
111 | 111 | tube:drop() |
112 | 112 | end) |
113 | 113 |
|
| 114 | +test:test('check tube existence', function(test) |
| 115 | + test:plan(14) |
| 116 | + local queue = require('queue') |
| 117 | + test:is(#queue.tube(), 0, 'checking for empty tube list') |
| 118 | + assert(#queue.tube() == 0) |
| 119 | + |
| 120 | + local tube1 = queue.create_tube('test1', 'fifo') |
| 121 | + test:is(#queue.tube(), 1, 'checking for not empty tube list') |
| 122 | + |
| 123 | + local tube2 = queue.create_tube('test2', 'fifo') |
| 124 | + test:is(#queue.tube(), 2, 'checking for not empty tube list') |
| 125 | + |
| 126 | + test:is(queue.tube('test1'), true, 'checking for tube existence') |
| 127 | + test:is(queue.tube('test2'), true, 'checking for tube existence') |
| 128 | + test:is(queue.tube('test3'), false, 'checking for tube nonexistence') |
| 129 | + |
| 130 | + tube2:drop() |
| 131 | + test:is(#queue.tube(), 1, 'checking for not empty tube list') |
| 132 | + |
| 133 | + test:is(queue.tube('test1'), true, 'checking for tube existence') |
| 134 | + test:is(queue.tube('test2'), false, 'checking for tube nonexistence') |
| 135 | + test:is(queue.tube('test3'), false, 'checking for tube nonexistence') |
| 136 | + |
| 137 | + tube1:drop() |
| 138 | + test:is(#queue.tube(), 0, 'checking for empty tube list') |
| 139 | + |
| 140 | + test:is(queue.tube('test1'), false, 'checking for tube nonexistence') |
| 141 | + test:is(queue.tube('test2'), false, 'checking for tube nonexistence') |
| 142 | + test:is(queue.tube('test3'), false, 'checking for tube nonexistence') |
| 143 | +end) |
| 144 | + |
114 | 145 | tnt.finish() |
115 | 146 |
|
116 | 147 | os.exit(test:check() == true and 0 or -1) |
|
0 commit comments