Skip to content

Commit

Permalink
Merge 643d375 into 6797777
Browse files Browse the repository at this point in the history
  • Loading branch information
mrogaski committed Sep 24, 2019
2 parents 6797777 + 643d375 commit 8ff9ac8
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 24 deletions.
57 changes: 57 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
--- Global configuration file. Copy, customize and store in your
-- project folder as '.luacov' for project specific configuration.
-- If some options are missing, their default values from this file
-- will be used.
-- @class module
-- @name luacov.defaults
return {

-- default filename to load for config options if not provided
-- only has effect in 'luacov.defaults.lua'
["configfile"] = ".luacov",

-- filename to store stats collected
["statsfile"] = "luacov.stats.out",

-- filename to store report
["reportfile"] = "luacov.report.out",

-- luacov.stats file updating frequency.
-- The lower this value - the more frequenty results will be written out to luacov.stats
-- You may want to reduce this value for short lived scripts (to for example 2) to avoid losing coverage data.
["savestepsize"] = 100,

-- Run reporter on completion? (won't work for ticks)
runreport = true,

-- Delete stats file after reporting?
deletestats = false,

-- Process Lua code loaded from raw strings
-- (that is, when the 'source' field in the debug info
-- does not start with '@')
codefromstrings = false,

-- Patterns for files to include when reporting
-- all will be included if nothing is listed
-- (exclude overrules include, do not include
-- the .lua extension, path separator is always '/')
["include"] = {},

-- Patterns for files to exclude when reporting
-- all will be included if nothing is listed
-- (exclude overrules include, do not include
-- the .lua extension, path separator is always '/')
["exclude"] = {
"luacov$",
"luacov/reporter$",
"luacov/defaults$",
"luacov/runner$",
"luacov/stats$",
"luacov/tick$",
"lua_install/",
"tests/"
},


}
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ before_install:
install:
- luarocks install bitlib
- luarocks install luaunit
- luarocks install luacov
- luarocks install luacov-coveralls

script:
- lua tests/TestUtility.lua -v
- lua tests/TestSettings.lua -v
- lua -lluacov tests/TestUtility.lua -v
- lua -lluacov tests/TestSettings.lua -v

after_success:
- luacov-coveralls

notifications:
email:
on_success: change
on_failure: always
on_failure: always
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This project uses [Semantic Versioning](http://semver.org/).

## 1.10.1 -- Unreleased
### Added
- Added unit test coverage reporting through Coveralls.

## [1.10.0] -- 2019-09-05
### Changed
- Moved to customer branch approach for WoW Classic releases.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
## Overview

[![Build Status](https://travis-ci.org/AIE-Guild/GreenWall.svg?branch=master)](https://travis-ci.org/AIE-Guild/GreenWall)
[![Coverage Status](https://coveralls.io/repos/github/AIE-Guild/GreenWall/badge.svg?branch=master)](https://coveralls.io/github/AIE-Guild/GreenWall?branch=master)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)

GreenWall is a World of Warcraft add-on that allows multiple guilds within a single realm, or
Expand Down
30 changes: 18 additions & 12 deletions tests/TestCompat.lua → tests/Loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ SOFTWARE.
--]]--------------------------------------------------------------------------

--
-- These functions adapt or mock Lua extensions in the WoW API.
--
require('bit')

function date(...)
return os.date(...)
end

function strmatch(...)
return string.match(...)
end
require('MockAPI')

require('Lib/LibStub')
require('Lib/CRC16-CCITT')
require('Lib/Base64BCA')
require('Lib/SemanticVersion')
require('Constants')
require('Globals')
require('Settings')
require('Utility')
require('HoldDown')
require('Config')
require('Compat')
require('Chat')
require('Channel')
require('API')
require('Interface')
require('GreenWall')
81 changes: 81 additions & 0 deletions tests/MockAPI.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
--[[--------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2010-2019 Mark Rogaski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]--------------------------------------------------------------------------

--
-- These functions adapt or mock Lua extensions in the WoW API.
--
require('bit')

-- Read the TOC file
local TOC = {}
f = io.open('GreenWall.toc')
while true do
line = f:read()
if line == nil then
break
end
k, v = string.match(line, '## (%a+): (.*)%s*$')
if k ~= nil then
TOC[k] = v
end
end
f:close()

function date(...)
return os.date(...)
end

function strmatch(...)
return string.match(...)
end

function GetAddOnMetadata(addon, field)
if addon == TOC['Title'] then
return TOC['Version']
end
return
end

function GetRealmName()
return 'EarthenRing'
end

function UnitName(target)
if target == 'player' then
return 'Ralff'
end
return
end

function GetBuildInfo()
x, y, z = string.match(TOC['Interface'], '(%d)(%d%d)(%d%d)')
version = string.format('%d.%d.%d', x, y, z)
return version, '12345', os.date(), TOC['Interface']
end

function hooksecurefunc(...)
return
end
4 changes: 1 addition & 3 deletions tests/TestSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ SOFTWARE.
--]]--------------------------------------------------------------------------

lu = require('luaunit')
require('TestCompat')
require('Constants')
require('Settings')
require('Loader')


--
Expand Down
7 changes: 1 addition & 6 deletions tests/TestUtility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ end
--

lu = require('luaunit')
require('TestCompat')
require('Lib/LibStub')
require('Lib/CRC16-CCITT')
require('Constants')
require('Utility')

require('Loader')


--
Expand Down

0 comments on commit 8ff9ac8

Please sign in to comment.