Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit bdecbe1

Browse files
committed
Initial commit
0 parents  commit bdecbe1

63 files changed

Lines changed: 9050 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (C) 2011 LuaDist.
2+
# Created by Peter Kapec
3+
# Redistribution and use of this file is allowed according to the terms of the MIT license.
4+
# For details see the COPYRIGHT file distributed with LuaDist.
5+
# Please note that the package source code is licensed under its own license.
6+
7+
PROJECT(lemock NONE)
8+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
9+
INCLUDE(dist.cmake)
10+
11+
# Install all files and documentation
12+
INSTALL (FILES build/lemock.lua DESTINATION ${INSTALL_LMOD})
13+
INSTALL (DIRECTORY build/htdocs/ DESTINATION ${INSTALL_DOC})

COPYRIGHT

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
LeMock License
2+
3+
4+
LeMock is licensed under the terms of the MIT license reproduced below. This
5+
means that LeMock is free software and can be used for both academic and
6+
commercial purposes at absolutely no cost.
7+
8+
--------------------------------------------------------------------------
9+
Copyright (C) 2009 Tommy Petterson <ptp@lysator.liu.se>
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a copy
12+
of this software and associated documentation files (the "Software"), to deal
13+
in the Software without restriction, including without limitation the rights
14+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+
copies of the Software, and to permit persons to whom the Software is
16+
furnished to do so, subject to the following conditions:
17+
18+
The above copyright notice and this permission notice shall be included in
19+
all copies or substantial portions of the Software.
20+
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27+
THE SOFTWARE.
28+
--------------------------------------------------------------------------

DEVEL

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
LeMock Developer Notes
2+
3+
4+
LeMock is implemented in Lua 5.1, but its source code is written as
5+
literate documents, and usees the tool noweb to generate the .lua files.
6+
The distributed source archive includes all the tangled files in the build
7+
directory, to avoid dependending on noweb for installation.
8+
9+
The source is contained in the src directory in the form of literate
10+
documents. To extract (tangle) the final files from the sources, the tool
11+
[noweb http://www.cs.tufts.edu/~nr/noweb/] is needed.
12+
13+
The source files are meant to be tangled together all at once, because the
14+
contents of a target file can be spread over several source files. The
15+
target files are all the chunk names that are roots. These can be found
16+
with noroots in the noweb toolbox. To automate the tangle process, there is
17+
a custom script named autotangle in the tools directory. This script finds
18+
all the target file names and tangles them in the current directory,
19+
creating subdirectories as needed. The script is written for yet another
20+
obscure tool, [rc http://www.libra-aries-books.co.uk/software/rc] [1]. It
21+
is probably easy to port the short rc script to your favourit language. It
22+
is invoked (in rc syntax) as:
23+
24+
``` ../tools/autotangle `{find ../src -name '*.nw'}
25+
26+
which means it wants all (recursively) .nw files in the src directory as
27+
arguments.
28+
29+
The documentation is written in [txt2tags http://txt2tags.sourceforge.net/],
30+
which can generate HTML among many other formats. The README, HISTORY,
31+
COPYRIGHT, and this DEVEL text file are written as simple txt2tags
32+
documents to remain readable as is. The .nw source files define wrapper
33+
txt2tags documents for the web pages, which use txt2tags' include mechanism
34+
to include the actual txt2tags files. The user guide is defined in the .nw
35+
sources as a separate txt2tags document, so it can be easily generated as a
36+
LaTeX document or Unix man page, but it too is included in a wrapper
37+
txt2tags document when generating the web pages.
38+
39+
The building of the web pages is done with
40+
[mk http://en.wikipedia.org/wiki/Mk_%28software%29], a Unix port of the
41+
Plan9 make tool. (The mk files uses rc syntax.)
42+
43+
A set of unit tests (defined in the .nw source) can be run with
44+
[lunit http://www.nessie.de/mroth/lunit/index.html] with the command:
45+
46+
``` lunit unit/*.lua
47+
48+
A program like [luacov http://luacov.luaforge.net/] can be used to check
49+
the coverage of the unit tests.
50+
51+
52+
--------------------
53+
== Footnotes ==
54+
: [1]
55+
I use Byron's Unix port, which syntax is extended and incompatible with
56+
the original (and other ports).
57+
:

HISTORY

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
LeMock History
2+
3+
4+
: 0.6
5+
- Actions can be set to raise an error.
6+
- //anytimes// and //atleastonce//.
7+
- Fail immediately if an unsatisfied action is closed.
8+
- Simplify semantics for Anyarg and Anyargs.
9+
- Documentation.
10+
: 0.5
11+
- Anyarg and Anyargs.
12+
- Third rewrite (major refactoring).
13+
: 0.4
14+
- Labels, dependencies, closes, and replay count limits.
15+
- Allow attribute modifying controller methods to be chained.
16+
: 0.3
17+
- Initial import.
18+
- This is the second rewrite of the initial prototype. It handles recording
19+
and replaying of actions with returnvalues, and verifies replay
20+
completeness.
21+
22+

README

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
LeMock Readme
2+
3+
4+
== What is Lua Easy Mock ==
5+
6+
LeMock (Lua Easy Mock) is a mock creation module intended for use together
7+
with a unit test framework such as lunit or lunity. It is inspired by
8+
EasyMock (for Java), and strives to be easy to use.
9+
10+
11+
== Availability ==
12+
13+
LeMock is hosted at LuaForge at http://luaforge.net/projects/lemock/
14+
15+
16+
== Installation ==
17+
18+
Copy the file build/lemock.lua to a Lua search path directory. This is
19+
usually something like ``/usr/share/lua/5.1/`` or
20+
``/usr/local/lib/lua/5.1/``. You can type ``print(package.path)`` at the
21+
Lua prompt to see what search path your Lua installation is using.
22+
23+
Documentation in HTML format is available in build/htdocs/.
24+
25+
26+
== License ==
27+
28+
LeMock is licensed under the MIT license, which is the same license that
29+
Lua uses. See COPYRIGHT_ for full terms.
30+
31+
32+
== User Documentation ==
33+
34+
See build/htdocs/userguide.html.
35+
36+
37+
== Development ==
38+
39+
LeMock is implemented in Lua 5.1, but its source code is written as
40+
literate documents, and uses the tool noweb to tangle the .lua files. The
41+
distributed source archive includes all the tangled files, to avoid
42+
depending on noweb for installation. See DEVEL_ for information about how
43+
the source code is organized, and what tools are needed for the build
44+
process.

build/htdocs/COPYRIGHT.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2+
<HTML>
3+
<HEAD>
4+
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
5+
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
6+
<TITLE>LeMock</TITLE>
7+
</HEAD>
8+
<BODY>
9+
10+
<DIV CLASS="header" ID="header">
11+
<H1>LeMock</H1>
12+
</DIV>
13+
14+
<DIV CLASS="body" ID="page-COPYRIGHT">
15+
<ul id="main_menu">
16+
<li id="main_menu-README"><a href="README.html" >Readme</a></li>
17+
<li id="main_menu-COPYRIGHT"><a href="COPYRIGHT.html">License</a></li>
18+
<li id="main_menu-userguide"><a href="userguide.html">Userguide</a></li>
19+
<li id="main_menu-HISTORY"><a href="HISTORY.html" >History</a></li>
20+
<li id="main_menu-DEVEL"><a href="DEVEL.html" >Devel</a></li>
21+
</ul>
22+
<H1>License</H1>
23+
<P>
24+
LeMock is licensed under the terms of the MIT license reproduced below. This
25+
means that LeMock is free software and can be used for both academic and
26+
commercial purposes at absolutely no cost.
27+
</P>
28+
<HR NOSHADE SIZE=1>
29+
<P>
30+
Copyright (C) 2009 Tommy Petterson &lt;<A HREF="mailto:ptp@lysator.liu.se">ptp@lysator.liu.se</A>&gt;
31+
</P>
32+
<P>
33+
Permission is hereby granted, free of charge, to any person obtaining a copy
34+
of this software and associated documentation files (the "Software"), to deal
35+
in the Software without restriction, including without limitation the rights
36+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37+
copies of the Software, and to permit persons to whom the Software is
38+
furnished to do so, subject to the following conditions:
39+
</P>
40+
<P>
41+
The above copyright notice and this permission notice shall be included in
42+
all copies or substantial portions of the Software.
43+
</P>
44+
<P>
45+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
49+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
50+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
51+
THE SOFTWARE.
52+
</P>
53+
<HR NOSHADE SIZE=1>
54+
</DIV>
55+
56+
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
57+
<!-- cmdline: txt2tags -t html -i www/COPYRIGHT.t2t -o htdocs/COPYRIGHT.html -->
58+
</BODY></HTML>

build/htdocs/DEVEL.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2+
<HTML>
3+
<HEAD>
4+
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
5+
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
6+
<TITLE>LeMock</TITLE>
7+
</HEAD>
8+
<BODY>
9+
10+
<DIV CLASS="header" ID="header">
11+
<H1>LeMock</H1>
12+
</DIV>
13+
14+
<DIV CLASS="body" ID="page-DEVEL">
15+
<ul id="main_menu">
16+
<li id="main_menu-README"><a href="README.html" >Readme</a></li>
17+
<li id="main_menu-COPYRIGHT"><a href="COPYRIGHT.html">License</a></li>
18+
<li id="main_menu-userguide"><a href="userguide.html">Userguide</a></li>
19+
<li id="main_menu-HISTORY"><a href="HISTORY.html" >History</a></li>
20+
<li id="main_menu-DEVEL"><a href="DEVEL.html" >Devel</a></li>
21+
</ul>
22+
<H1>Developer Notes</H1>
23+
<P>
24+
LeMock is implemented in Lua 5.1, but its source code is written as
25+
literate documents, and usees the tool noweb to generate the .lua files.
26+
The distributed source archive includes all the tangled files in the build
27+
directory, to avoid dependending on noweb for installation.
28+
</P>
29+
<P>
30+
The source is contained in the src directory in the form of literate
31+
documents. To extract (tangle) the final files from the sources, the tool
32+
<A HREF="http://www.cs.tufts.edu/~nr/noweb/">noweb</A> is needed.
33+
</P>
34+
<P>
35+
The source files are meant to be tangled together all at once, because the
36+
contents of a target file can be spread over several source files. The
37+
target files are all the chunk names that are roots. These can be found
38+
with noroots in the noweb toolbox. To automate the tangle process, there is
39+
a custom script named autotangle in the tools directory. This script finds
40+
all the target file names and tangles them in the current directory,
41+
creating subdirectories as needed. The script is written for yet another
42+
obscure tool, <A HREF="http://www.libra-aries-books.co.uk/software/rc">rc</A> [1]. It
43+
is probably easy to port the short rc script to your favourit language. It
44+
is invoked (in rc syntax) as:
45+
</P>
46+
<PRE>
47+
../tools/autotangle `{find ../src -name '*.nw'}
48+
</PRE>
49+
<P></P>
50+
<P>
51+
which means it wants all (recursively) .nw files in the src directory as
52+
arguments.
53+
</P>
54+
<P>
55+
The documentation is written in <A HREF="http://txt2tags.sourceforge.net/">txt2tags</A>,
56+
which can generate HTML among many other formats. The README, HISTORY,
57+
COPYRIGHT, and this DEVEL text file are written as simple txt2tags
58+
documents to remain readable as is. The .nw source files define wrapper
59+
txt2tags documents for the web pages, which use txt2tags' include mechanism
60+
to include the actual txt2tags files. The user guide is defined in the .nw
61+
sources as a separate txt2tags document, so it can be easily generated as a
62+
LaTeX document or Unix man page, but it too is included in a wrapper
63+
txt2tags document when generating the web pages.
64+
</P>
65+
<P>
66+
The building of the web pages is done with
67+
<A HREF="http://en.wikipedia.org/wiki/Mk_%28software%29">mk</A>, a Unix port of the
68+
Plan9 make tool. (The mk files uses rc syntax.)
69+
</P>
70+
<P>
71+
A set of unit tests (defined in the .nw source) can be run with
72+
<A HREF="http://www.nessie.de/mroth/lunit/index.html">lunit</A> with the command:
73+
</P>
74+
<PRE>
75+
lunit unit/*.lua
76+
</PRE>
77+
<P></P>
78+
<P>
79+
A program like <A HREF="http://luacov.luaforge.net/">luacov</A> can be used to check
80+
the coverage of the unit tests.
81+
</P>
82+
<HR NOSHADE SIZE=1>
83+
<H2>Footnotes</H2>
84+
<DL>
85+
<DT>[1]</DT><DD>
86+
I use Byron's Unix port, which syntax is extended and incompatible with
87+
the original (and other ports).
88+
</DL>
89+
90+
<HR NOSHADE SIZE=1>
91+
<P>
92+
2009-05-31
93+
</P>
94+
</DIV>
95+
96+
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
97+
<!-- cmdline: txt2tags -t html -i www/DEVEL.t2t -o htdocs/DEVEL.html -->
98+
</BODY></HTML>

build/htdocs/HISTORY.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2+
<HTML>
3+
<HEAD>
4+
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
5+
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
6+
<TITLE>LeMock</TITLE>
7+
</HEAD>
8+
<BODY>
9+
10+
<DIV CLASS="header" ID="header">
11+
<H1>LeMock</H1>
12+
</DIV>
13+
14+
<DIV CLASS="body" ID="page-HISTORY">
15+
<ul id="main_menu">
16+
<li id="main_menu-README"><a href="README.html" >Readme</a></li>
17+
<li id="main_menu-COPYRIGHT"><a href="COPYRIGHT.html">License</a></li>
18+
<li id="main_menu-userguide"><a href="userguide.html">Userguide</a></li>
19+
<li id="main_menu-HISTORY"><a href="HISTORY.html" >History</a></li>
20+
<li id="main_menu-DEVEL"><a href="DEVEL.html" >Devel</a></li>
21+
</ul>
22+
<H1>History</H1>
23+
<DL>
24+
<DT>0.6</DT><DD>
25+
<UL>
26+
<LI>Actions can be set to raise an error.
27+
<LI><I>anytimes</I> and <I>atleastonce</I>.
28+
<LI>Fail immediately if an unsatisfied action is closed.
29+
<LI>Simplify semantics for Anyarg and Anyargs.
30+
<LI>Documentation.
31+
</UL>
32+
<DT>0.5</DT><DD>
33+
<UL>
34+
<LI>Anyarg and Anyargs.
35+
<LI>Third rewrite (major refactoring).
36+
</UL>
37+
<DT>0.4</DT><DD>
38+
<UL>
39+
<LI>Labels, dependencies, closes, and replay count limits.
40+
<LI>Allow attribute modifying controller methods to be chained.
41+
</UL>
42+
<DT>0.3</DT><DD>
43+
<UL>
44+
<LI>Initial import.
45+
<LI>This is the second rewrite of the initial prototype. It handles recording
46+
and replaying of actions with returnvalues, and verifies replay
47+
completeness.
48+
</UL>
49+
</DL>
50+
51+
<HR NOSHADE SIZE=1>
52+
<P>
53+
2009-05-31
54+
</P>
55+
</DIV>
56+
57+
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
58+
<!-- cmdline: txt2tags -t html -i www/HISTORY.t2t -o htdocs/HISTORY.html -->
59+
</BODY></HTML>

0 commit comments

Comments
 (0)