base: drops obsolute SCM rockspecs
[luajson.git] / tests / testutil.lua
blob7231a86987a4580e5bcd81c1b6a9485ca44acf0d
1 local pcall, error = pcall, error
3 local lunit = require("lunit")
4 local assert_error = lunit.assert_error
6 -- Allow module to alter decoder
7 local function setDecoder(d)
8 _G.decode = d
9 end
10 module("testutil", package.seeall)
11 function buildPatchedDecoder(f, newDecoder)
12 return function()
13 setDecoder(newDecoder)
14 f()
15 end
16 end
17 function buildFailedPatchedDecoder(f, newDecoder)
18 return function()
19 setDecoder(newDecoder)
20 assert_error(f)
21 end
22 end