diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-29 19:18:02 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-29 19:18:02 +0300 |
commit | d38a022654548d44122428f71dc8f0ebd7b34167 (patch) | |
tree | 6e0c2ef8785349b7c0b4a4b14449605bade87e83 | |
parent | d043da47e5d98e99e515edcdab951abe40be4681 (diff) | |
download | luacov-d38a022654548d44122428f71dc8f0ebd7b34167.tar.gz |
0.12.0 release
-rw-r--r-- | README.md | 64 | ||||
-rw-r--r-- | doc/doc/index.html | 16 | ||||
-rw-r--r-- | doc/doc/ldoc.css | 2 | ||||
-rw-r--r-- | doc/doc/modules/luacov.defaults.html | 44 | ||||
-rw-r--r-- | doc/doc/modules/luacov.hook.html | 114 | ||||
-rw-r--r-- | doc/doc/modules/luacov.html | 9 | ||||
-rw-r--r-- | doc/doc/modules/luacov.reporter.html | 53 | ||||
-rw-r--r-- | doc/doc/modules/luacov.runner.html | 15 | ||||
-rw-r--r-- | doc/doc/modules/luacov.stats.html | 6 | ||||
-rw-r--r-- | doc/doc/modules/luacov.tick.html | 6 | ||||
-rw-r--r-- | doc/doc/modules/luacov.util.html | 213 | ||||
-rw-r--r-- | doc/index.html | 52 | ||||
-rw-r--r-- | src/luacov/defaults.lua | 8 | ||||
-rw-r--r-- | src/luacov/runner.lua | 2 |
14 files changed, 531 insertions, 73 deletions
@@ -20,7 +20,17 @@ page](https://github.com/keplerproject/luacov/releases). It can also be installed using Luarocks: - luarocks install luacov +``` +luarocks install luacov +``` + +In order to additionally install experimental C extensions that improve +performance and analysis accuracy install [CLuaCov] +(https://github.com/mpeterv/cluacov) package instead: + +``` +luarocks install cluacov +``` LuaCov is written in pure Lua and has no external dependencies. @@ -51,9 +61,9 @@ file named `luacov.report.out`. The script takes the following parameters: luacov [-c=configfile] [filename...] For the `-c` option see below at [configuration](#configuration). The filenames -(actually Lua patterns) indicate the files to include in the report, specifying them here -equals to adding them to the `include` list in the configuration file, with `.lua` -extension stripped. +(actually Lua patterns) indicate the files to include in the report, specifying +them here equals to adding them to the `include` list in the configuration +file, with `.lua` extension stripped. This is an example output of the report file: @@ -75,35 +85,44 @@ themselves). LuaCov saves its stats upon normal program termination. If your program is a daemon -- in other words, if it does not terminate normally -- you can use the -`luacov.tick` module, which periodically saves the stats file. For example, to -run (on Unix systems) LuaCov on -[Xavante](http://keplerproject.github.io/xavante/), just modify the first line of -`xavante_start.lua` so it reads: +`luacov.tick` module or `tick` configuration option, which periodically saves +the stats file. For example, to run (on Unix systems) LuaCov on +[Xavante](http://keplerproject.github.io/xavante/), just modify the first line +of `xavante_start.lua` so it reads: + +``` +#!/usr/bin/env lua -lluacov.tick +``` + +or add + +```lua +tick = true +``` - #!/usr/bin/env lua -lluacov.tick +to `.luacov` config file. ## Configuration LuaCov includes several configuration options, which have their defaults stored in `src/luacov/defaults.lua`. These are the global defaults. To use -project specific configuration, create a Lua script returning a table -with some options and store it as `.luacov` in the project directory from -where `luacov` is being run. For example, this config informs LuaCov that -only `foo` module and its submodules should be covered and that they are -located inside `src` directory: +project specific configuration, create a Lua script setting options as globals +or returning a table with some options and store it as `.luacov` in the project +directory from where `luacov` is being run. For example, this config informs +LuaCov that only `foo` module and its submodules should be covered and that +they are located inside `src` directory: ```lua -return { - modules = { - ["foo"] = "src/foo/init.lua", - ["foo.*"] = "src" - } +modules = { + ["foo"] = "src/foo/init.lua", + ["foo.*"] = "src" } ``` For a full list of options, see -[`luacov.defaults` documentation](http://keplerproject.github.io/luacov/doc/modules/luacov.defaults.html). +[`luacov.defaults` documentation] +(http://keplerproject.github.io/luacov/doc/modules/luacov.defaults.html). ## Custom reporter engines @@ -119,10 +138,11 @@ After cloning this repo, these commands may be useful: * `luarocks make` to install LuaCov from local sources; * `make test` to run tests (does not require installing beforehand); -* `ldoc .` to regenerate documentation using [LDoc](https://github.com/stevedonovan/LDoc). +* `ldoc .` to regenerate documentation using [LDoc] + (https://github.com/stevedonovan/LDoc). * `luacheck .` to lint using [Luacheck](https://github.com/mpeterv/luacheck). ## Credits LuaCov was designed and implemented by Hisham Muhammad as a tool for testing -[LuaRocks](http://www.luarocks.org). +[LuaRocks](https://luarocks.org/). diff --git a/doc/doc/index.html b/doc/doc/index.html index 26c4d57..7871d24 100644 --- a/doc/doc/index.html +++ b/doc/doc/index.html @@ -33,10 +33,12 @@ <ul class="nowrap"> <li><a href="modules/luacov.html">luacov</a></li> <li><a href="modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="modules/luacov.hook.html">luacov.hook</a></li> <li><a href="modules/luacov.reporter.html">luacov.reporter</a></li> <li><a href="modules/luacov.runner.html">luacov.runner</a></li> <li><a href="modules/luacov.stats.html">luacov.stats</a></li> <li><a href="modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -54,7 +56,11 @@ </tr> <tr> <td class="name" nowrap><a href="modules/luacov.defaults.html">luacov.defaults</a></td> - <td class="summary">Default configuration file.</td> + <td class="summary">Default values for configuration options.</td> + </tr> + <tr> + <td class="name" nowrap><a href="modules/luacov.hook.html">luacov.hook</a></td> + <td class="summary">Hook module, creates debug hook used by LuaCov.</td> </tr> <tr> <td class="name" nowrap><a href="modules/luacov.reporter.html">luacov.reporter</a></td> @@ -73,13 +79,17 @@ <td class="summary">Load luacov using this if you want it to periodically save the stats file.</td> </tr> + <tr> + <td class="name" nowrap><a href="modules/luacov.util.html">luacov.util</a></td> + <td class="summary">Utility module.</td> + </tr> </table> </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/ldoc.css b/doc/doc/ldoc.css index 7a954f4..269f328 100644 --- a/doc/doc/ldoc.css +++ b/doc/doc/ldoc.css @@ -28,7 +28,7 @@ del,ins { text-decoration: none; } li { - list-style: disc; +// list-style: disc; margin-left: 20px; } caption,th { diff --git a/doc/doc/modules/luacov.defaults.html b/doc/doc/modules/luacov.defaults.html index 52bdc0e..c512c18 100644 --- a/doc/doc/modules/luacov.defaults.html +++ b/doc/doc/modules/luacov.defaults.html @@ -41,10 +41,12 @@ <ul class="nowrap"> <li><a href="../modules/luacov.html">luacov</a></li> <li><strong>luacov.defaults</strong></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -52,11 +54,10 @@ <div id="content"> <h1>Module <code>luacov.defaults</code></h1> -<p>Default configuration file.</p> -<p> 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.</p> +<p>Default values for configuration options.</p> +<p> For project specific configuration create '.luacov' file in your project + folder. It should be a Lua script setting various options as globals + or returning table of options.</p> <h2><a href="#Tables">Tables</a></h2> @@ -85,6 +86,10 @@ <td class="summary">Filename to store report.</td> </tr> <tr> + <td class="name" nowrap><a href="#tick">tick</a></td> + <td class="summary">Enable saving coverage data after every <a href="../modules/luacov.defaults.html#savestepsize">savestepsize</a> lines?</td> + </tr> + <tr> <td class="name" nowrap><a href="#savestepsize">savestepsize</a></td> <td class="summary">Stats file updating frequency for <a href="../modules/luacov.tick.html#">luacov.tick</a>.</td> </tr> @@ -163,11 +168,10 @@ <h3>Usage:</h3> <ul> - <pre class="example"> - modules = { - [<span class="string">"some_rock"</span>] = <span class="string">"src/some_rock.lua"</span>, - [<span class="string">"some_rock.*"</span>] = <span class="string">"src"</span> - }</pre> + <pre class="example">modules = { + [<span class="string">"some_rock"</span>] = <span class="string">"src/some_rock.lua"</span>, + [<span class="string">"some_rock.*"</span>] = <span class="string">"src"</span> +}</pre> </ul> </dd> @@ -204,6 +208,22 @@ </dd> <dt> + <a name = "tick"></a> + <strong>tick</strong> + </dt> + <dd> + Enable saving coverage data after every <a href="../modules/luacov.defaults.html#savestepsize">savestepsize</a> lines? + Setting this flag to <code>true</code> in config is equivalent to running LuaCov + using <a href="../modules/luacov.tick.html#">luacov.tick</a> module. Default: false. + + + + + + + +</dd> + <dt> <a name = "savestepsize"></a> <strong>savestepsize</strong> </dt> @@ -271,8 +291,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.hook.html b/doc/doc/modules/luacov.hook.html new file mode 100644 index 0000000..2c8ce8a --- /dev/null +++ b/doc/doc/modules/luacov.hook.html @@ -0,0 +1,114 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>LuaCov Reference</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>LuaCov</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/luacov.html">luacov</a></li> + <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><strong>luacov.hook</strong></li> + <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> + <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> + <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> + <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>luacov.hook</code></h1> +<p>Hook module, creates debug hook used by LuaCov.</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#new">new (runner)</a></td> + <td class="summary">Creates a new debug hook.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "new"></a> + <strong>new (runner)</strong> + </dt> + <dd> + Creates a new debug hook. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">runner</span> + runner module. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + debug hook function that uses runner fields and functions + and sets <code>runner.data</code>. + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/doc/modules/luacov.html b/doc/doc/modules/luacov.html index d599026..ae4f40a 100644 --- a/doc/doc/modules/luacov.html +++ b/doc/doc/modules/luacov.html @@ -36,10 +36,12 @@ <ul class="nowrap"> <li><strong>luacov</strong></li> <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -51,7 +53,8 @@ <p> Useful for launching scripts from the command-line. Returns the <a href="../modules/luacov.runner.html#">luacov.runner</a> module.</p> <h3>Usage:</h3> <ul> - <pre class="example">lua -lluacov sometest.lua</pre> + <pre class="example">lua -lluacov sometest.lua +</pre> </ul> @@ -65,8 +68,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.reporter.html b/doc/doc/modules/luacov.reporter.html index d1884b5..a2bd1cb 100644 --- a/doc/doc/modules/luacov.reporter.html +++ b/doc/doc/modules/luacov.reporter.html @@ -33,7 +33,7 @@ <h2>Contents</h2> <ul> <li><a href="#Functions">Functions</a></li> -<li><a href="#Class_ReporterBase">Class ReporterBase </a></li> +<li><a href="#Class_ReporterBase">Class ReporterBase</a></li> </ul> @@ -41,10 +41,12 @@ <ul class="nowrap"> <li><a href="../modules/luacov.html">luacov</a></li> <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><strong>luacov.reporter</strong></li> <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -65,7 +67,7 @@ <td class="summary">Runs the report generator.</td> </tr> </table> -<h2><a href="#Class_ReporterBase">Class ReporterBase </a></h2> +<h2><a href="#Class_ReporterBase">Class ReporterBase</a></h2> <table class="function_list"> <tr> <td class="name" nowrap><a href="#ReporterBase:config">ReporterBase:config ()</a></td> @@ -96,6 +98,10 @@ <td class="summary">Stub method called before processing a file.</td> </tr> <tr> + <td class="name" nowrap><a href="#ReporterBase:on_file_error">ReporterBase:on_file_error (filename, error_type, message)</a></td> + <td class="summary">Stub method called if a file couldn't be processed due to an error.</td> + </tr> + <tr> <td class="name" nowrap><a href="#ReporterBase:on_empty_line">ReporterBase:on_empty_line (filename, lineno, line)</a></td> <td class="summary">Stub method called for each empty source line and other lines that can't be hit.</td> @@ -155,7 +161,7 @@ </dd> </dl> - <h2 class="section-header has-description"><a name="Class_ReporterBase"></a>Class ReporterBase </h2> + <h2 class="section-header has-description"><a name="Class_ReporterBase"></a>Class ReporterBase</h2> <div class="section-description"> Basic reporter class stub. @@ -163,12 +169,11 @@ Provides some helper methods and stubs to be overridden by child classes. </div> <h3>Usage:</h3> - <pre class="example"> - <span class="keyword">local</span> MyReporter = <span class="global">setmetatable</span>({}, ReporterBase) - MyReporter.__index = MyReporter - <span class="keyword">function</span> MyReporter:on_hit_line(...) - self:write((<span class="string">"File %s: hit line %s %d times"</span>):format(...)) - <span class="keyword">end</span></pre> + <pre class="example"><span class="keyword">local</span> MyReporter = <span class="global">setmetatable</span>({}, ReporterBase) +MyReporter.__index = MyReporter +<span class="keyword">function</span> MyReporter:on_hit_line(...) + self:write((<span class="string">"File %s: hit line %s %d times"</span>):format(...)) +<span class="keyword">end</span></pre> <dl class="function"> <dt> <a name = "ReporterBase:config"></a> @@ -295,6 +300,32 @@ </dd> <dt> + <a name = "ReporterBase:on_file_error"></a> + <strong>ReporterBase:on_file_error (filename, error_type, message)</strong> + </dt> + <dd> + Stub method called if a file couldn't be processed due to an error. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filename</span> + name of the file. + </li> + <li><span class="parameter">error_type</span> + "open", "read" or "load". + </li> + <li><span class="parameter">message</span> + error message. + </li> + </ul> + + + + + +</dd> + <dt> <a name = "ReporterBase:on_empty_line"></a> <strong>ReporterBase:on_empty_line (filename, lineno, line)</strong> </dt> @@ -422,8 +453,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.runner.html b/doc/doc/modules/luacov.runner.html index 74ee7f9..5e0cfd6 100644 --- a/doc/doc/modules/luacov.runner.html +++ b/doc/doc/modules/luacov.runner.html @@ -41,10 +41,12 @@ <ul class="nowrap"> <li><a href="../modules/luacov.html">luacov</a></li> <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> <li><strong>luacov.runner</strong></li> <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -216,11 +218,10 @@ <h3>Usage:</h3> <ul> - <pre class="example"> - <span class="keyword">local</span> <span class="keyword">function</span> custom_hook(_, line) - runner.debug_hook(_, line, <span class="number">3</span>) - extra_processing(line) - <span class="keyword">end</span></pre> + <pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> custom_hook(_, line) + runner.debug_hook(_, line, <span class="number">3</span>) + extra_processing(line) +<span class="keyword">end</span></pre> </ul> </dd> @@ -550,8 +551,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.stats.html b/doc/doc/modules/luacov.stats.html index c1f5a74..646e06c 100644 --- a/doc/doc/modules/luacov.stats.html +++ b/doc/doc/modules/luacov.stats.html @@ -40,10 +40,12 @@ <ul class="nowrap"> <li><a href="../modules/luacov.html">luacov</a></li> <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> <li><strong>luacov.stats</strong></li> <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -134,8 +136,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.tick.html b/doc/doc/modules/luacov.tick.html index 45241ab..df7176d 100644 --- a/doc/doc/modules/luacov.tick.html +++ b/doc/doc/modules/luacov.tick.html @@ -36,10 +36,12 @@ <ul class="nowrap"> <li><a href="../modules/luacov.html">luacov</a></li> <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> <li><strong>luacov.tick</strong></li> + <li><a href="../modules/luacov.util.html">luacov.util</a></li> </ul> </div> @@ -67,8 +69,8 @@ </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> -<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i> -<i style="float:right;">Last updated 2016-04-18 11:50:47 </i> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> diff --git a/doc/doc/modules/luacov.util.html b/doc/doc/modules/luacov.util.html new file mode 100644 index 0000000..b269ba3 --- /dev/null +++ b/doc/doc/modules/luacov.util.html @@ -0,0 +1,213 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>LuaCov Reference</title> + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>LuaCov</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Modules</h2> +<ul class="nowrap"> + <li><a href="../modules/luacov.html">luacov</a></li> + <li><a href="../modules/luacov.defaults.html">luacov.defaults</a></li> + <li><a href="../modules/luacov.hook.html">luacov.hook</a></li> + <li><a href="../modules/luacov.reporter.html">luacov.reporter</a></li> + <li><a href="../modules/luacov.runner.html">luacov.runner</a></li> + <li><a href="../modules/luacov.stats.html">luacov.stats</a></li> + <li><a href="../modules/luacov.tick.html">luacov.tick</a></li> + <li><strong>luacov.util</strong></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>luacov.util</code></h1> +<p>Utility module.</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#unprefix">unprefix (str, prefix)</a></td> + <td class="summary">Removes a prefix from a string if it's present.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#load_string">load_string (str[, env[, chunkname]])</a></td> + <td class="summary">Loads a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#load_config">load_config (name, env)</a></td> + <td class="summary">Load a config file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#file_exists">file_exists (name)</a></td> + <td class="summary">Checks if a file exists.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "unprefix"></a> + <strong>unprefix (str, prefix)</strong> + </dt> + <dd> + Removes a prefix from a string if it's present. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + a string. + </li> + <li><span class="parameter">prefix</span> + a prefix string. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + original string if does not start with prefix + or string without prefix. + </ol> + + + + +</dd> + <dt> + <a name = "load_string"></a> + <strong>load_string (str[, env[, chunkname]])</strong> + </dt> + <dd> + Loads a string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + a string. + </li> + <li><span class="parameter">env</span> + environment table. + (<em>optional</em>) + </li> + <li><span class="parameter">chunkname</span> + chunk name. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "load_config"></a> + <strong>load_config (name, env)</strong> + </dt> + <dd> + Load a config file. + Reads, loads and runs a Lua file in an environment. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + file name. + </li> + <li><span class="parameter">env</span> + environment table. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true and the first return value of config on success, + nil + error type + error message on failure, where error type + can be "read", "load" or "run". + </ol> + + + + +</dd> + <dt> + <a name = "file_exists"></a> + <strong>file_exists (name)</strong> + </dt> + <dd> + Checks if a file exists. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + file name. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true if file can be opened, false otherwise. + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.4</a></i> +<i style="float:right;">Last updated 2016-06-29 18:46:30 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/doc/index.html b/doc/index.html index 565e46c..a9a4d5c 100644 --- a/doc/index.html +++ b/doc/index.html @@ -89,11 +89,21 @@ luarocks install luacov </div> <p> -LuaCov is written in pure Lua and has no external dependencies. +There are some C extensions LuaCov can use (if they are available) to improve performance +and analysis accuracy. To install LuaCov with these extensions install +<a href="https://github.com/mpeterv/cluacov">CLuaCov</a> package instead: +</p> + +<div class="Example"> +luarocks install cluacov +</div> + +<p> +LuaCov itself is written in pure Lua and has no external dependencies. </p> <p> -Alternatively, you can get the code directly from <a href="http://github.com/keplerproject/luacov">the git repo</a>. +You can also get the code directly from <a href="http://github.com/keplerproject/luacov">the git repo</a>. </p> <h2><a name="instructions"></a>Instructions</h2> @@ -163,9 +173,9 @@ not the sources themselves). <p> LuaCov saves its stats upon normal program termination. If your program is a daemon -- in other words, if it does not terminate normally -- you -can use the <tt>luacov.tick</tt> module, which periodically saves the -stats file. For example, to run (on Unix systems) LuaCov on -<a href="http://keplerproject.github.io/xavante/">Xavante</a>, +can use the <tt>luacov.tick</tt> module or the <tt>tick</tt> configuration option, +which periodically saves the stats file. For example, to run (on Unix systems) +LuaCov on <a href="http://keplerproject.github.io/xavante/">Xavante</a>, just modify the first line of <tt>xavante_start.lua</tt> so it reads: </p> @@ -173,9 +183,41 @@ just modify the first line of <tt>xavante_start.lua</tt> so it reads: #!/usr/bin/env lua -lluacov.tick </div> +or add this to <tt>.luacov</tt> config file: + +<div class="Example"> +tick = true +</div> + +LuaCov includes several configuration options, which have their defaults +stored in <a href="doc/modules/luacov.defaults.html">luacov.defaults module</a>. +These are the global defaults. To use project specific configuration, create a Lua script +setting options as globals or returning a table with some options and store it as +<tt>.luacov</tt> in the project directory from where <tt>luacov</tt> is being run. +For example, this config informs LuaCov that only <tt>foo</tt> module and its submodules +should be covered and that they are located inside <tt>src</tt> directory: + +<div class="Example"><pre> +modules = { + ["foo"] = "src/foo/init.lua", + ["foo.*"] = "src" +} +</pre></div> + <h2><a name="history"></a>History</h2> <dl> + <dt><strong>0.12.0</strong> [June 29, 2016]</dt> + <dd> + <ul> + <li>Added support for experimental C extensions (<a href="https://github.com/mpeterv/cluacov">CLuaCov</a>).</li> + <li>Changed config format: options are now set by assigning to globals, old format (returning a table) is still supported.</li> + <li>Added <tt>tick</tt>config option, equivalent to using <tt>luacov.tick</tt> module.</li> + <li>Fixed coverage data being saved to wrong file when using relative <tt>statsfile</tt> path and the program running LuaCov changes directories.</li> + <li>Improved config loading error handling.</li> + <li>Added <tt>:on_file_error()</tt> stub method to base reporter class, used for reporting problems when analyzing coverage data related to a file.</li> + </ul> + </dd> <dt><strong>0.11.0</strong> [April 18, 2016]</dt> <dd> <ul> diff --git a/src/luacov/defaults.lua b/src/luacov/defaults.lua index 4986109..4343b4a 100644 --- a/src/luacov/defaults.lua +++ b/src/luacov/defaults.lua @@ -1,7 +1,7 @@ ---- Default 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. +--- Default values for configuration options. +-- For project specific configuration create '.luacov' file in your project +-- folder. It should be a Lua script setting various options as globals +-- or returning table of options. -- @class module -- @name luacov.defaults return { diff --git a/src/luacov/runner.lua b/src/luacov/runner.lua index c5a2a00..9016ac8 100644 --- a/src/luacov/runner.lua +++ b/src/luacov/runner.lua @@ -6,7 +6,7 @@ local runner = {} --- LuaCov version in `MAJOR.MINOR.PATCH` format. -runner.version = "0.11.0" +runner.version = "0.12.0" local stats = require("luacov.stats") local util = require("luacov.util") |