1
0

Improved loading of pretty.

This commit is contained in:
Jon Michael Aanes 2017-07-17 13:36:56 +02:00
parent 6a677a65b2
commit 00d3f653a8
8 changed files with 13 additions and 8 deletions

View File

@ -1 +1,4 @@
return require 'pretty.pretty'
local premodule = (...)
if premodule == 'init' then premodule = '' end
return require (premodule .. (premodule ~= '' and '.' or '') .. 'pretty')

View File

@ -1,5 +1,5 @@
local SUITE = require('TestSuite').new('analyze_structure')
local SUITE = require 'TestSuite' 'analyze_structure'
SUITE:setEnviroment {
analyze_structure = require('analyze_structure'),
TABLE_TYPE = require('table_type')

View File

@ -1,5 +1,5 @@
local SUITE = require('TestSuite').new('function')
local SUITE = require 'TestSuite' 'function'
SUITE:setEnviroment{
format = require('pretty')
}

View File

@ -1,5 +1,5 @@
local SUITE = require('TestSuite').new('number')
local SUITE = require 'TestSuite' 'number'
SUITE:setEnviroment{
format = require('pretty')
}

View File

@ -1,5 +1,5 @@
local SUITE = require('TestSuite').new('pretty')
local SUITE = require 'TestSuite' 'pretty'
SUITE:setEnviroment{
format = require('pretty')
}
@ -395,6 +395,8 @@ SUITE:addTest('UseCase: Can load function from file that is shortly deleted', fu
local yo = require(module_name)
-- Remove module
os.remove('./'..module_name..'.lua')
package.loaded[module_name] = nil
-- Format the function, even though the module it came from is gone.
format(yo)
assert(true)

View File

@ -22,7 +22,7 @@ end
--------------------------------------------------------------------------------
local SUITE = require('TestSuite').new('resilience')
local SUITE = require 'TestSuite' 'resilience'
SUITE:setEnviroment{
pretty = require('pretty'),
setfenv = setfenv,

View File

@ -1,5 +1,5 @@
local SUITE = require('TestSuite').new('sorting')
local SUITE = require 'TestSuite' 'sorting'
SUITE:setEnviroment{
pretty = require('pretty')
}

View File

@ -4,6 +4,6 @@ package.path = package.path .. ';./test/?.lua;./src/?.lua'
local TEST_SUITE = require("TestSuite").new('pretty')
TEST_SUITE:enableStrictGlobal()
TEST_SUITE:addModules('test/test_*')
-- TEST_SUITE:generateRequireSubmodule 'require'
TEST_SUITE:addModuleTests 'pretty'
TEST_SUITE:setOptions(...)
TEST_SUITE:runTests()