aboutsummaryrefslogtreecommitdiff
path: root/tests.lua
blob: a9803f810a3cc7e4d9b273d95521b0b066b14f14 (plain) (blame)
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
#!/usr/bin/env lua

local opensubtitles = require 'server.opensubtitles'
local util = require 'lib.util'

local errs = 0

local test_opensubtitles = function ()
    local ohash, name, id, new_id

    ohash = '395787dbe5b42001'
    name = 'Fight.Club.1999.REMASTERED.720p.BRRip.XviD.AC3-RARBG'
    id = '5449593'
    new_id = opensubtitles.search_ohash(ohash, name)
    if new_id then
        new_id = new_id:match('%d*$')
    end

    if id ~= new_id then
        util.error('opensubtitles: id mismatch')
        errs = errs + 1
    end
end

test_opensubtitles()

if errs == 0  then
    print('ok: all tests ran successfully')
else
    os.exit(false)
end