-
Notifications
You must be signed in to change notification settings - Fork 52
/
070-compat.t
executable file
·46 lines (35 loc) · 1.95 KB
/
070-compat.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env tarantool
local test = require('tap').test()
test:plan(3)
local qcompat = require('queue.compat')
test:ok(qcompat, 'queue compatibility layer exists')
test:test('*_version', function(test)
test:plan(10)
local split_version = qcompat.split_version
local check_version = qcompat.check_version
test:is_deeply(split_version("1.6.8-173"), {"1", "6", "8", "173"}, "check split_version 1")
test:is_deeply(split_version("1.7.1-0"), {"1", "7", "1", "0"}, "check split_version 2")
test:is_deeply(split_version("1.7.1"), {"1", "7", "1"}, "check split_version 3")
test:is(check_version({1, 7, 1}, "1.8.1-0"), true, "check supported version")
test:is(check_version({1, 7, 1}, "1.7.1-0"), true, "check supported version")
test:is(check_version({1, 7, 1}, "1.7.1-1"), true, "check supported version")
test:is(check_version({1, 7, 2}, "1.8.1"), true, "check supported version")
test:is(check_version({1, 7, 1}, "1.6.9"), false, "check unsupported version")
test:is(check_version({1, 7, 1}, "1.6.9-100"), false, "check unsupported version")
test:is(check_version({1, 7, 1}, "1.6.9-100"), false, "check unsupported version")
end)
test:test("check compatibility names", function(test)
test:plan(7)
local vinyl_name = qcompat.vinyl_name
local num_name = qcompat.num_type
local str_name = qcompat.str_type
test:is(vinyl_name("1.7.1-168"), "vinyl", "check new name (vinyl)")
test:is(num_name("1.7.2-1"), "unsigned", "check new name (unsigned)")
test:is(num_name("1.6.9-168"), "num", "check old name (num)")
test:is(num_name("1.7.1-168"), "num", "check old name (num)")
test:is(str_name("1.7.2-1"), "string", "check new name (string)")
test:is(str_name("1.6.9-168"), "str", "check old name (str)")
test:is(str_name("1.7.1-168"), "str", "check old name (str)")
end)
os.exit(test:check() and 0 or 1)
-- vim: set ft=lua: