Skip to content

Commit

Permalink
added luarock inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdugne committed Jun 15, 2017
1 parent a64095f commit 001a4ae
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .luacov
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ return {
['configfile'] = '.luacov',

-- filename to store stats collected
['statsfile'] = 'test/luacov.stats.out',
['statsfile'] = 'luacov.stats.out',

-- filename to store report
['reportfile'] = 'luacov.report.out',
Expand Down
2 changes: 1 addition & 1 deletion app/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function App:start(options)
print( 'Cherry: ' .. App.cherryVersion)
print('--------------------------------')
print('extensions:')
_G.tprint(App.extension, 1)
print(_G.inspect(App.extension, 1))
print('--------------------------------')

self:deviceSetup()
Expand Down
4 changes: 3 additions & 1 deletion cherry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ _G.Effects = require 'engine.effects'
_G.Game = require 'engine.game'
_G.Sound = require 'engine.sound'

require 'tprint'
-- debug
_G.inspect = require 'inspect'

1 change: 1 addition & 0 deletions install-rocks
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ luarocks install busted;
luarocks install luacheck;
luarocks install luacov;
luarocks install dkjson;
luarocks install inspect;
21 changes: 0 additions & 21 deletions libs/tprint.lua

This file was deleted.

44 changes: 0 additions & 44 deletions test/.luacov

This file was deleted.

10 changes: 1 addition & 9 deletions test/_global.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
expose('[setting up tests Globals]', function()
require('tprint')

_G.sleep = function(n)
local t = os.clock()
while os.clock() - t <= n do
-- nothing
end
end

_G.inspect = require('inspect')
_G.display = require('mocks.display')
_G.transition = require('mocks.transition')
_G.App = require('mocks.app')
Expand Down
16 changes: 16 additions & 0 deletions test/mocks/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ display = {
newText.size = size
return newText
end,
newEmbossedText = function(options)
local newText = newDisplayObject()
newText.setEmbossColor = function(text, color)
local highlight = color.highlight
local shadow = color.shadow
newText.highlight = { r = highlight.r, g = highlight.g, b = highlight.b }
newText.shadow = { r = shadow.r, g = shadow.g, b = shadow.b }
end

newText.x = options.x
newText.y = options.y
newText.text = options.text
newText.size = options.size

return newText
end,
currentStage = _currentStage,
getCurrentStage = function() return display.currentStage end,
TopLeftReferencePoint = 7,
Expand Down
4 changes: 2 additions & 2 deletions test/run
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
if [[ $1 = "travis" ]]; then
busted \
busted -v \
--run=tests \
--config-file=test/.busted \
-m '/home/travis/build/chrisdugne/cherry/test/?.lua;/home/travis/build/chrisdugne/cherry/libs/?.lua;/home/travis/build/chrisdugne/cherry/?.lua'
else
busted \
busted -v \
--run=tests \
--config-file=test/.busted
fi
19 changes: 19 additions & 0 deletions test/spec/libs/text.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local Text = require 'text'

describe('[text]', function()
it('> should create Text.embossed', function()
local parent = display.newGroup()
local text = Text.embossed({
parent = parent,
text = 'foo',
x = 111,
y = 222,
width = 333,
height = 444,
fontSize = 20
})

assert.are.equal(text.x, 111)
assert.are.equal(text.y, 222)
end)
end)

0 comments on commit 001a4ae

Please sign in to comment.