public
Description: Loonar: The flexible object system for Lua
Homepage:
Clone URL: git://github.com/dahlia/loonar.git
loonar / run_tests.lua
100755 45 lines (35 sloc) 0.889 kb
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
#!/usr/bin/env lua
 
require 'tests.test'
require 'loonar.spec'
 
-- Load Native extensions
require 'loonar.table'
require 'loonar.string'
 
-- Load loonar
require 'loonar.class'
require 'loonar.object'
require 'loonar.array'
 
-- Tests
require 'spec.array'
require 'spec.class'
require 'tests.object'
-- require 'tests.array'
 
-- Report executed spec result
spec.verbose = true
spec.report()
 
-- Helper functions for __LINE__ and __FILE__
function __FILE__() return debug.getinfo(2, 'S').source end
function __LINE__() return debug.getinfo(2, 'l').currentline end
 
-- Execute all tests
for i = 1, #test.fails do
  local fail = test.fails[i]
  print(i .. ". " .. fail.message)
  print(fail.trace)
end
 
if #test.fails == 1 then
  print("1 test failed!")
elseif #test.fails > 1 then
  print(#test.fails .. " tests failed!")
else
  print "all tests succeed!"
end
 
-- vim:set ts=2 sw=2 sts=2 et: