Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
silentbicycle committed Sep 25, 2010
1 parent 5abd94d commit 1a64abe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 315,15 @@ function test_vararg()
assert_equal(15, m{ "foo", 1, 2, 3, 4, 5})
end

function test_approx()
local function approx(a)
return function(b) return math.abs(a-b) < 1 end
end
local m = tamale.matcher {
{ {approx(5), approx(10)}, true }
}
assert_true(m {5.1, 10.1})
assert_false(m {5.1, 11.1})
end

lunatest.run()

0 comments on commit 1a64abe

Please sign in to comment.