luaunit-3.1/0000777000000000000000000000000012477651646011212 5ustar 00000000000000luaunit-3.1/.travis.yml0000666000000000000000000000044212477651646013323 0ustar 00000000000000language: erlang env: matrix: - LUA=lua5.1 - LUA=lua5.2 before_install: - sudo apt-get install $LUA libxml2-utils script: - $LUA run_unit_tests.lua - $LUA run_functional_tests.lua notifications: email: on_success: change on_failure: always luaunit-3.1/doc/0000777000000000000000000000000012477651667011762 5ustar 00000000000000luaunit-3.1/doc/conf.py0000666000000000000000000002032712477651646013262 0ustar 00000000000000# -*- coding: utf-8 -*- # # LuaUnit documentation build configuration file, created by # sphinx-quickstart on Thu Aug 21 21:45:55 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'LuaUnit' copyright = u'2014, Philippe Fremy' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '1.6' # The full version, including alpha/beta/rc tags. release = '1.6' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'LuaUnitdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'LuaUnit.tex', u'LuaUnit Documentation', u'Philippe Fremy', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'luaunit', u'LuaUnit Documentation', [u'Philippe Fremy'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'LuaUnit', u'LuaUnit Documentation', u'Philippe Fremy', 'LuaUnit', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False luaunit-3.1/doc/html/0000777000000000000000000000000012477651667012726 5ustar 00000000000000luaunit-3.1/doc/html/.buildinfo0000666000000000000000000000035212477651667014702 0ustar 00000000000000# Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. config: fb27224e30e26e071ea02ea0ed6f41cf tags: 645f666f9bcd5a90fca523b33c5a78b7 luaunit-3.1/doc/html/genindex.html0000666000000000000000000001343012477651667015416 0ustar 00000000000000 Index — LuaUnit 1.6 documentation luaunit-3.1/doc/html/index.html0000666000000000000000000023364212477651667014735 0ustar 00000000000000 Welcome to LuaUnit’s documentation! — LuaUnit 1.6 documentation

Welcome to LuaUnit’s documentation!

Introduction

LuaUnit is a unit-testing framework for Lua. It allows you to write test functions and test classes with test methods, combined with setup/teardown functionality. A wide range of assertions are supported.

LuaUnit supports several output format, like Junit or TAP, for easier integration into Continuous Integration platforms (Jenkins, Maven, ...) . The integrated command-line options provide a flexible interface to select tests by name or patterns, control output format, set verbosity, ...

Platform support

LuaUnit works with Lua 5.1 and 5.2 . It is tested on Windows XP, Windows Server 2003 and Ubuntu 14.04 (see continuous build results on Travis-CI and AppVeyor ) and should work on all platforms supported by lua. It has no other dependency than lua itself.

LuaUnit is packed into a single-file. To make start using it, just add the file to your project.

Development

LuaUnit is developed on Github.

Bugs or feature requests should be reported using GitHub issues.

Usage and development may be discussed on LuaUnit mailing-list . If you are using LuaUnit for your project, please drop us an note.

It is released under the BSD license.

This documentation is available at Read-the-docs.

Version and Changelog

This documentation describes the functionality of LuaUnit v3.1 .

New in version 3.1

  • luaunit no longer pollutes global namespace, unless defining EXPORT_ASSERT_TO_GLOBALS to true
  • fixes and validation of JUnit XML generation
  • strip luaunit internal information from stacktrace
  • general improvements of test results with duration and other details
  • improve printing for tables, with an option to always print table id
  • fix printing of recursive tables

Important note when upgrading to version 3.1 : assertions functions are no longer exported directly to the global namespace. See Enabling global or module-level functions

New in version 3.0 - 9 oct 2014

Because LuaUnit was forked and released as some 2.x version, version number is now jumping to 3.0 .

  • full documentation available in text, html and pdf at read-the-docs.org
  • new output format: JUnit, compatible with Bamboo and other CI platforms
  • much better table assertions
  • new assertions for strings, with patterns and case insensitivity: assertStrContains, assertNotStrContains, assertNotStrIContains, assertStrIContains, assertStrMatches
  • new assertions for floats: assertAlmostEquals, assertNotAlmostEquals
  • type assertions: assertIsString, assertIsNumber, ...
  • error assertions: assertErrorMsgEquals, assertErrorMsgContains, assertErrorMsgMatches
  • improved error messages for several assertions
  • command-line options to select test, control output type and verbosity

New in version 1.5 - 8. Nov 2012

  • compatibility with Lua 5.1 and 5.2
  • better object model internally
  • a lot more of internal tests
  • several internal bug fixes
  • make it easy to customize the test output
  • running test functions no longer requires a wrapper
  • several level of verbosity

New in version 1.4 - 26. Jul 2012

  • switch from X11 to more popular BSD license
  • add TAP output format for integration into Jenkins
  • official repository now on github

New in version 1.3 - 30. Oct 2007

  • port to lua 5.1
  • iterate over the test classes, methods and functions in the alphabetical order
  • change the default order of expected, actual in assertEquals (adjustable with USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS).

Version 1.2 - 13. Jun 2005

  • first public release

Version 1.1

  • move global variables to internal variables
  • assertion order is configurable between expected/actual or actual/expected
  • new assertion to check that a function call returns an error
  • display the calling stack when an error is spotted
  • two verbosity level, like in python unittest

Getting started

Setting up your test script

To get started, create your file test_something.lua .

The script should import LuaUnit:

luaunit = require('luaunit')

The last line executes your script with LuaUnit and exit with the proper error code:

os.exit( luaunit.LuaUnit.run() )

Now, run your file with:

lua test_something.lua

It prints something like:

Ran 0 tests in 0 seconds
OK

Now, your testing framework is in place, you can start writing tests.

Writing tests

LuaUnit scans all variables that start with test or Test. If they are functions, or if they are tables that contain functions that start with test or Test, they are run as part of the test suite.

So just write a function whose name starts with test. Inside test functions, use the assertions functions provided by LuaUnit, such as assertEquals().

Let’s see that in practice.

Suppose you want to test the following add function:

function add(v1,v2)
    -- add positive numbers
    -- return 0 if any of the numbers are 0
    -- error if any of the two numbers are negative
    if v1 < 0 or v2 < 0 then
        error('Can only add positive or null numbers, received '..v1..' and '..v2)
    end
    if v1 == 0 or v2 == 0 then
        return 0
    end
    return v1+v2
end

You write the following tests:

function testAddPositive()
    luaunit.assertEquals(add(1,1),2)
end

function testAddZero()
    luaunit.assertEquals(add(1,0),0)
    luaunit.assertEquals(add(0,5),0)
    luaunit.assertEquals(add(0,0),0)
end

assertEquals() is the most common used assertion function. It simply verifies that both argument are equals, in the order actual value, expected value.

Rerun your test script (-v is to activate a more verbose output)

lua test_something.lua -v

It now prints:

Started on 03/10/15 16:45:41
    TestAdd.testAddPositive ... Ok
    TestAdd.testAddZero ... Ok
=========================================================
Ran 2 tests in 0.010 seconds
OK

You always have:

  • the date at which the test suite was started
  • the group to which the function belongs (usually, the name of the function table, and <TestFunctions> for all direct test functions)
  • the name of the function being executed
  • a report at the end, with number of executed test, number of non selected tests, number of failures and duration.

You also want to test that when the function receives negative numbers, it generates an error. Use assertError() or even better, assertErrorMsgContains() to also validate the content of the error message. There are other types or error checking functions, see Error assertions . Here we use assertErrorMsgContains() . First argument is the expected message, then the function to call and the optional arguments:

function testAddError()
    luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3)
end

Now, suppose we also have the following function to test:

function adder(v)
    -- return a function that adds v to its argument using add
    function closure( x ) return x+v end
    return closure
end

We want to test the type of the value returned by adder and its behavior. LuaUnit provides assertion for type testing (see Type assertions). In this case, we use assertIsFunction():

function testAdder()
    f = adder(3)
    luaunit.assertIsFunction( f )
    luaunit.assertEquals( f(2), 5 )
end

Grouping tests, setup/teardown functionality

When the number of tests starts to grow, you usually organise them into separate groups. You can do that with LuaUnit by putting them inside a table (whose name must start with Test or test ).

For example, assume we have a second function to test:

function div(v1,v2)
    -- divide positive numbers
    -- return 0 if any of the numbers are 0
    -- error if any of the two numbers are negative
    if v1 < 0 or v2 < 0 then
        error('Can only divide positive or null numbers, received '..v1..' and '..v2)
    end
    if v1 == 0 or v2 == 0 then
        return 0
    end
    return v1/v2
end

We move the tests related to the function add into their own table:

TestAdd = {}
    function TestAdd:testAddPositive()
        luaunit.assertEquals(add(1,1),2)
    end

    function TestAdd:testAddZero()
        luaunit.assertEquals(add(1,0),0)
        luaunit.assertEquals(add(0,5),0)
        luaunit.assertEquals(add(0,0),0)
    end

    function TestAdd:testAddError()
        luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3)
    end

    function TestAdd:testAdder()
        f = adder(3)
        luaunit.assertIsFunction( f )
        luaunit.assertEquals( f(2), 5 )
    end
-- end of table TestAdd

Then we create a second set of tests for div:

TestDiv = {}
    function TestDiv:testDivPositive()
        luaunit.assertEquals(div(4,2),2)
    end

    function TestDiv:testDivZero()
        luaunit.assertEquals(div(4,0),0)
        luaunit.assertEquals(div(0,5),0)
        luaunit.assertEquals(div(0,0),0)
    end

    function TestDiv:testDivError()
        luaunit.assertErrorMsgContains('Can only divide positive or null numbers, received 2 and -3', div, 2, -3)
    end
-- end of table TestDiv

Execution of the test suite now looks like this:

Started on 03/10/15 16:47:33
    TestAdd.testAddError ... Ok
    TestAdd.testAddPositive ... Ok
    TestAdd.testAddZero ... Ok
    TestAdd.testAdder ... Ok
    TestDiv.testDivError ... Ok
    TestDiv.testDivPositive ... Ok
    TestDiv.testDivZero ... Ok
=========================================================
Ran 7 tests in 0.010 seconds
OK

When tests are defined in tables, you can optionally define two special functions, setUp() and tearDown(), which will be executed respectively before and after every test.

These function may be used to create specific resources for the test being executed and cleanup the test environment.

For a practical example, imagine that we have a log() function that writes strings to a log file on disk. The file is created upon first usage of the function, and the filename is defined by calling the function initLog().

The tests for these functions would take advantage of the setup/teardown functionality to prepare a log filename shared by all tests, make sure that all tests start with a non existing log file name, and erase the log filename after every test:

TestLogger = {}
    function TestLogger:setUp()
        -- define the fname to use for logging
        self.fname = 'mytmplog.log'
        -- make sure the file does not already exists
        os.remove(self.fname)
    end

    function TestLogger:testLoggerCreatesFile()
        initLog(self.fname)
        log('toto')
        -- make sure that our log file was created
        f = io.open(self.fname, 'r')
        luaunit.assertNotNil( f )
        f:close()
    end

    function TestLogger:tearDown()
        -- cleanup our log file after all tests
        os.remove(self.fname)
    end

Note

Errors generated during execution of setUp() or tearDown() functions are considered test failures.

Using the command-line

You can control the LuaUnit execution from the command-line:

Output format

Choose the test output format with -o or --output. Available formats are:

  • text: the default output format
  • nil: no output at all
  • TAP: TAP format
  • junit: output junit xml

Example of non-verbose text format:

$ lua doc/test_something.lua
.......
Ran 7 tests in 0.002 seconds
OK

Example of TAP format:

$ lua doc/test_something.lua -o TAP
1..7
# Started on 03/10/15 16:50:09
# Starting class: TestAdd
ok     1        TestAdd.testAddError
ok     2        TestAdd.testAddPositive
ok     3        TestAdd.testAddZero
ok     4        TestAdd.testAdder
# Starting class: TestDiv
ok     5        TestDiv.testDivError
ok     6        TestDiv.testDivPositive
ok     7        TestDiv.testDivZero
# Ran 7 tests in 0.022 seconds, 7 successes, 0 failures

List of tests to run

You can list some test names on the command-line to run only those tests. The name must be the exact match of either the test table, the test function or the test table and the test method. The option may be repeated.

Example:

-- Run all TestAdd table tests and one test of TestDiv table.
$ lua doc/test_something.lua TestAdd TestDiv.testDivError -v
Started on 03/10/15 16:52:20
    TestAdd.testAddError ... Ok
    TestAdd.testAddPositive ... Ok
    TestAdd.testAddZero ... Ok
    TestAdd.testAdder ... Ok
    TestDiv.testDivError ... Ok
=========================================================
Ran 5 tests in 0.000 seconds
OK

Filtering tests

The most flexible approach for selecting tests to run is to use a pattern. With --pattern or -p, you can provide a lua pattern and only the tests that contain the pattern will actually be run.

Example:

-- Run all tests of zero testing and error testing
-- by using the magic character .
lua my_test_suite.lua -v -p Err.r -p Z.ro

For our test suite, it gives the following output:

Started on 03/10/15 16:48:29
    TestAdd.testAddError ... Ok
    TestAdd.testAddZero ... Ok
    TestDiv.testDivError ... Ok
    TestDiv.testDivZero ... Ok
=========================================================
Ran 4 tests in 0.010 seconds
OK (ignored=3)

The number of tests ignored by the selection is printed, along with the test result. The pattern can be any lua pattern. Be sure to exclude all magic characters with % (like -+?*) and protect your pattern from the shell interpretation by putting it in quotes.

Conclusion

You now know enough of LuaUnit to start writing your test suite. Check the reference documentation for a complete list of assertions, command-line options and specific behavior.

Reference documentation

Enabling global or module-level functions

Versions of LuaUnit before version 3.1 would export all assertions functions to the global namespace. A typical lua test file would look like this:

require('luaunit')

TestToto = {} --class

    function TestToto:test1_withFailure()
        local a = 1
        assertEquals( a , 1 )
        -- will fail
        assertEquals( a , 2 )
    end

[...]

However, this is an obsolete practice in Lua. It is now recommended to keep all functions inside the module. Starting from version 3.1 LuaUnit follows this practice and the code should be adapted to look like this:

-- the imported module must be stored
luaunit = require('luaunit')

TestToto = {} --class

    function TestToto:test1_withFailure()
        local a = 1
        luaunit.assertEquals( a , 1 )
        -- will fail
        luaunit.assertEquals( a , 2 )
    end

[...]

If you prefer the old way, LuaUnit can continue to export assertions functions if you set the following global variable prior to importing LuaUnit:

-- this works
EXPORT_ASSERT_TO_GLOBALS = true
require('luaunit')

TestToto = {} --class

    function TestToto:test1_withFailure()
        local a = 1
        assertEquals( a , 1 )
        -- will fail
        assertEquals( a , 2 )
    end

[...]

LuaUnit.run() function

Return value

Normally, you should run your test suite with the following line:

os.exit(luaunit.LuaUnit.run())

The run() function returns the number of failures of the test suite. This is good for an exit code, 0 meaning success.

Arguments

If no arguments are supplied, it parses the command-line arguments of the script and interpret them. If arguments are supplied to the function, they are parsed instead of the command-line. It uses the same syntax.

Example:

-- execute tests matching the 'withXY' pattern
os.exit(luaunit.LuaUnit.run('--pattern', 'withXY'))

Choice of tests

If test names were supplied, only those tests are executed. When test names are supplied, they don’t have to start with test, they are run anyway.

If no test names were supplied, a general test collection process starts under the following rules:

  • all variable starting with test or Test are scanned.

  • if the variable is a function it is collected for testing

  • if the variable is a table:

    • all keys starting with test or Test are collected (provided that they are functions)
    • keys with name setUp and tearDown are also collected

If one or more pattern were supplied, the test are then filtered according the pattern(s). Only the test that match the pattern(s) are actually executed.

setup and teardown

The function setUp() is executed before each test if it exists in the table. The function tearDown() is executed after every test if it exists in the table.

Note

tearDown() is always executed if it exists, even if there was a failure in the test or in the setUp() function. Failures in setUp() or tearDown() are considered as a general test failures.

LuaUnit.runSuite() function

If you want to keep the flexibility of the command-line parsing, but want to force some parameters, like the output format, you must use a slightly different syntax:

lu = luaunit.LuaUnit.new()
lu:setOutputType("tap")
os.exit( lu:runSuite() )

runSuite() behaves like run() except that it must be started with a LuaUnit instance as first argument, and it will use the LuaUnit instance settings.

Command-line options

Usage: lua <your_test_suite.lua> [options] [testname1 [testname2]

Test names

When no test names are supplied, all tests are collected.

The syntax for supplying test names can be either: name of the function, name of the table or name of the table + ‘.’ + name of the function. Only the supplied tests will be executed.

Selecting output format

Choose the output format with the syntax -o FORMAT or --output FORMAT.

Formats available:

  • text: the default output format of LuaUnit
  • nil: no output at all
  • tap: output compatible with the Test Anything Protocol
  • junit: output compatible with the JUnit xml format (used by many CI platforms)

Warning

In the JUnit format, a destination filename must be supplied with --name or -n

Destination filename

When using the JUnit format, the test suites writes an XML file with the test results. The file name is mandatory and must be supplied with: --name FILENAME or -n FILENAME

Selecting tests with patterns

You select a subset of tests by specifying one or more filter patterns, with -p PATTERN or --pattern PATTERN.

The pattern is looked for on the full test name TestTable.testMethod . Only the tests that actually match the pattern are selected. When specifying more than one pattern, they are tried one by one until the name matches (OR combination).

Make sure you esape magic chars like +?-* with % .

Other Options:

  • -h, --help: display the command-line help.
  • --version: display the version information
  • -v, --verbose: Increase the output verbosity. The exact effect depends on the output format. May be specified multiple times.
  • -q, --quiet: Set verbosity to minimum. The exact effect depends on the output format.

Assertions functions

You will now find the list of all assertion functions. For all functions, When an assertion fails, the failure message tries to be as informative as possible, by displaying the expectation and value that caused the failure.

Note

see :More on table printing: to know more about tables.

Equality assertions

All equality assertions functions take two arguments, in the order actual value then expected value. Some people are more familiar with the order expected value then actual value. It is possible to configure LuaUnit to use the opposite order for all equality assertions, by setting up a module variable:

luaunit.ORDER_ACTUAL_EXPECTED=false

The order only matters for the message that is displayed in case of failures. It does not influence the test itself.

assertEquals(actual, expected)

Assert that two values are equal.

For tables, the comparison is a deep comparison :

  • number of elements must be the same
  • tables must contain the same keys
  • each key must contain the same values. The values are also compared recursively with deep comparison.

LuaUnit provides other table-related assertions, see Table assertions

assertNotEquals(actual, expected)

Assert that two values are different. The assertion fails if the two values are identical.

It also uses table deep comparison.

assertAlmostEquals(actual, expected, margin)

Assert that two floating point numbers are almost equal.

When comparing floating point numbers, strict equality does not work. Computer arithmetic is so that an operation that mathematically yields 1.00000000 might yield 0.999999999999 in lua . That’s why you need an almost equals comparison, where you specify the error margin.

assertNotAlmostEquals(actual, expected, margin)

Assert that two floating point numbers are not almost equal.

Value assertions

assertTrue(value)

Assert that a given value compares to true. Lua coercion rules are applied so that values like 0, "", 1.17 all compare to true.

assertFalse(value)

Assert that a given value compares to false. Lua coercion rules are applied so that only nil and false all compare to false.

assertNil(value)

Assert that a given value is nil .

assertNotNil(value)

Assert that a given value is not nil . Lua coercion rules are applied so that values like 0, "", false all validate the assertion.

assertIs(actual, expected)

Assert that two variables are identical. For string, numbers, boolean and for nil, this gives the same result as assertEquals() . For the other types, identity means that the two variables refer to the same object.

Example :

s1='toto'
s2='to'..'to'
t1={1,2}
t2={1,2}

luaunit.assertIs(s1,s1) -- ok
luaunit.assertIs(s1,s2) -- ok
luaunit.assertIs(t1,t1) -- ok
luaunit.assertIs(t1,t2) -- fail
assertNotIs(actual, expected)

Assert that two variables are not identical, in the sense that they do not refer to the same value. See assertIs() for more details.

String assertions

Assertions related to string and patterns.

assertStrContains(str, sub[, useRe])

Assert that a string contains the given substring or pattern.

By default, substring is searched in the string. If useRe is provided and is true, sub is treated as a pattern which is searched inside the string str .

assertStrIContains(str, sub)

Assert that a string contains the given substring, irrespective of the case.

Not that unlike assertStrcontains(), you can not search for a pattern.

assertNotStrContains(str, sub, useRe)

Assert that a string does not contain a given substring or pattern.

By default, substring is searched in the string. If useRe is provided and is true, sub is treated as a pattern which is searched inside the string str .

assertNotStrIContains(str, sub)

Assert that a string does not contain the given substring, irrespective of the case.

Not that unlike assertNotStrcontains(), you can not search for a pattern.

assertStrMatches(str, pattern[, start[, final]])

Assert that a string matches the full pattern pattern.

If start and final are not provided or are nil, the pattern must match the full string, from start to end. The functions allows to specify the expected start and end position of the pattern in the string.

Error assertions

Error related assertions, to verify error generation and error messages.

assertError(func, ...)

Assert that calling functions func with the arguments yields an error. If the function does not yield an error, the assertion fails.

Note that the error message itself is not checked, which means that this function does not distinguish between the legitimate error that you expect and another error that might be triggered by mistake.

The next functions provide a better approach to error testing, by checking explicitly the error message content.

Note

When testing LuaUnit, switching from assertError() to assertErrorMsgEquals() revealed quite a few bugs!

assertErrorMsgEquals(expectedMsg, func, ...)

Assert that calling function func will generate exactly the given error message. If the function does not yield an error, or if the error message is not identical, the assertion fails.

Be careful when using this function that error messages usually contain the file name and line number information of where the error was generated. This is usually inconvenient. To ignore the filename and line number information, you can either use a pattern with assertErrorMsgMatches() or simply check for the message containt with assertErrorMsgContains() .

assertErrorMsgContains(partialMsg, func, ...)

Assert that calling function func will generate an error message containing partialMsg . If the function does not yield an error, or if the expected message is not contained in the error message, the assertion fails.

assertErrorMsgMatches(expectedPattern, func, ...)

Assert that calling function func will generate an error message matching expectedPattern . If the function does not yield an error, or if the error message does not match the provided patternm the assertion fails.

Note that matching is done from the start to the end of the error message. Be sure to escape magic all magic characters with % (like -+.?*) .

Type assertions

The following functions all perform type checking on their argument. If the received value is not of the right type, the failure message will contain the expected type, the received type and the received value to help you identify better the problem.
assertIsNumber(value)

Assert that the argument is a number (integer or float)

assertIsString(value)

Assert that the argument is a string.

assertIsTable(value)

Assert that the argument is a table.

assertIsBoolean(value)

Assert that the argument is a boolean.

assertIsNil(value)

Assert that the argument is a nil.

assertIsFunction(value)

Assert that the argument is a function.

assertIsUserdata(value)

Assert that the argument is a userdata.

assertIsCoroutine(value)

Assert that the argument is a coroutine (an object with type thread ).

assertIsThread(value)

An alias for assertIsCoroutine().

Table assertions

assertItemsEquals(actual, expected)

Assert that two tables contain the same items, irrespective of their keys.

This function is practical for example if you want to compare two lists but where items are not in the same order:

luaunit.assertItemsEquals( {1,2,3}, {3,2,1} ) -- assertion succeeds
The comparison is not recursive on the items: if any of the items are tables, they are compared using table equality (like as in assertEquals() ), where the key matters.
luaunit.assertItemsEquals( {1,{2,3},4}, {4,{3,2,},1} ) -- assertion fails because {2,3} ~= {3,2}

Annexes

Annex A: More on table printing

When asserting tables equality, by default, the table content is printed in case of failures. LuaUnit tries to print tables in a readable format. It is possible to always display the table id along with the content, by setting a module parameter PRINT_TABLE_REF_IN_ERROR_MSG . This helps identifying tables:

local t1 = {1,2,3}
-- normally, t1 is dispalyed as: "{1,2,3}"

-- if setting this:
luaunit.PRINT_TABLE_REF_IN_ERROR_MSG = true

-- display of table t1 becomes: "<table: 0x29ab56> {1,2,3}"

Note

table loops

When displaying table content, it is possible to encounter loops, if for example two table references eachother. In such cases, LuaUnit display the full table content once, along with the table id, and displays only the table id for the looping reference.

Example: displaying a table with reference loop

local t1 = {}
local t2 = {}
t1.t2 = t2
t1.a = {1,2,3}
t2.t1 = t1

-- when displaying table t1:
--   table t1 inside t2 is only displayed by its id because t1 is already being displayed
--   table t2 is displayed along with its id because it is part of a loop.
-- t1: "<table: 0x29ab56> { a={1,2,3}, t2=<table: 0x27ab23> {t1=<table: 0x29ab56>} }"

Index and Search page

luaunit-3.1/doc/html/objects.inv0000666000000000000000000000105012477651667015071 0ustar 00000000000000# Sphinx inventory version 2 # Project: LuaUnit # Version: 1.6 # The remainder of this file is compressed using zlib. xڝTn0C{0R(*RAU7ɒDױvO3;2 VL(hhM5aP #􉴢¯qc8'/ ֊pYYwVBB.j# 7>WK7Ȣ;J9bsW/2#߮tfc>~vXk3FPesI 5RڨnJp&p E( tHA.#ֻJ֡x27}6]ݑmv+*_Z3ґ,:qm_̤kT()RgPz> RIu PR2zN/g l0TҚn$öKqey*Qsѐ,&(*qΙ0՞bMYF r*ǢM}xFluaunit-3.1/doc/html/search.html0000666000000000000000000000613612477651667015067 0ustar 00000000000000 Search — LuaUnit 1.6 documentation

Search

Please activate JavaScript to enable the search functionality.

From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

luaunit-3.1/doc/html/searchindex.js0000666000000000000000000001335312477651667015566 0ustar 00000000000000Search.setIndex({envversion:42,terms:{all:0,code:0,follow:0,disk:0,whose:0,depend:0,readabl:0,specif:0,export_assert_to_glob:0,expectedpattern:0,under:0,sens:0,junit:0,everi:0,fals:0,failur:0,exact:0,tri:0,magic:0,list:0,iter:0,assertequ:0,item:0,adjust:0,div:0,pleas:0,direct:0,jump:0,zero:0,assertisfunct:0,port:0,compat:0,sub:0,compar:0,testadderror:0,anywai:0,"public":0,full:0,assertiscoroutin:0,gener:0,here:0,closur:0,let:0,ubuntu:0,along:0,becom:0,interpret:0,prior:0,assertstricontain:0,chang:0,assertalmostequ:0,prefer:0,put:0,"boolean":0,coercion:0,unit:0,from:0,describ:0,would:0,scan:0,containt:0,upgrad:0,next:0,few:0,call:0,recommend:0,until:0,withxi:0,exit:0,peopl:0,relat:0,asserttru:0,must:0,err:0,testtabl:0,alia:0,prepar:0,work:0,can:0,control:0,tap:0,give:0,process:0,share:0,minimum:0,want:0,alwai:0,end:0,quot:0,anoth:0,your_test_suit:0,organis:0,resourc:0,after:0,spot:0,befor:0,mai:0,multipl:0,pdf:0,grow:0,github:0,practic:0,divid:0,asserti:0,element:0,caus:0,inform:0,"switch":0,combin:0,allow:0,order:0,help:0,testloggercreatesfil:0,offici:0,move:0,becaus:0,increas:0,flexibl:0,paramet:0,fix:0,better:0,window:0,mail:0,might:0,easier:0,non:0,good:0,"return":0,thei:0,python:0,pollut:0,framework:0,instead:0,now:0,discuss:0,choic:0,name:0,anyth:0,drop:0,separ:0,each:0,testdivzero:0,x11:0,complet:0,mean:0,subset:0,continu:0,expect:0,our:0,special:0,variabl:0,influenc:0,content:0,adapt:0,common:0,assertisnumb:0,insid:0,given:0,test_someth:0,releas:0,org:0,care:0,thread:0,keep:0,filter:0,coroutin:0,asserterrormsgcontain:0,first:0,oper:0,rang:0,directli:0,onc:0,assertitemsequ:0,number:0,date:0,unlik:0,alreadi:0,done:0,messag:0,open:0,differ:0,licens:0,esap:0,assertstrmatch:0,eachoth:0,wrapper:0,stack:0,interfac:0,"final":0,store:0,shell:0,namespac:0,travi:0,specifi:0,print_table_ref_in_error_msg:0,part:0,pars:0,testlogg:0,exactli:0,than:0,wide:0,provid:0,remov:0,second:0,charact:0,project:0,matter:0,str:0,were:0,order_actual_expect:0,comput:0,assertisboolean:0,ran:0,argument:0,assertnotalmostequ:0,have:0,need:0,"null":0,imagin:0,self:0,mytmplog:0,note:0,also:0,testadd:0,take:0,fname:0,environ:0,singl:0,even:0,sure:0,unless:0,normal:0,object:0,most:0,adder:0,bsd:0,"class":0,don:0,doc:0,request:0,doe:0,partialmsg:0,place:0,neg:0,opposit:0,verbos:0,substr:0,syntax:0,protocol:0,find:0,asserterrormsgequ:0,xml:0,userdata:0,onli:0,explicitli:0,just:0,configur:0,activ:0,should:0,suppos:0,local:0,over:0,familiar:0,assertstrcontain:0,report:0,requir:0,reveal:0,yield:0,method:0,irrespect:0,integr:0,contain:0,testdiv:0,where:0,valid:0,testdivposit:0,see:0,mandatori:0,result:0,fail:0,close:0,inconveni:0,jenkin:0,someth:0,lua:0,enough:0,between:0,"import":0,approach:0,verifi:0,accord:0,kei:0,expectedmsg:0,posit:0,distinguish:0,setoutputtyp:0,both:0,protect:0,last:0,howev:0,quiet:0,instanc:0,improv:0,simpli:0,point:0,unittest:0,testtoto:0,suppli:0,respect:0,assum:0,quit:0,assertisstr:0,assertist:0,initlog:0,much:0,treat:0,ani:0,func:0,those:0,"case":0,ident:0,look:0,durat:0,defin:0,assertnotstrcontain:0,behavior:0,my_test_suit:0,margin:0,loop:0,pack:0,advantag:0,almost:0,them:0,destin:0,itself:0,eras:0,sever:0,obsolet:0,perform:0,alphabet:0,make:0,belong:0,same:0,html:0,behav:0,nil:0,upon:0,effect:0,assertnotnil:0,user:0,mani:0,typic:0,patternm:0,exampl:0,thi:0,choos:0,model:0,usual:0,identifi:0,execut:0,when:0,exclud:0,testmethod:0,easi:0,trigger:0,except:0,add:0,cleanup:0,appli:0,match:0,build:0,which:0,format:0,read:0,know:0,assertfals:0,recurs:0,testaddzero:0,like:0,success:0,filenam:0,integ:0,server:0,collect:0,either:0,asserterror:0,popular:0,output:0,bamboo:0,testfunct:0,encount:0,right:0,old:0,some:0,intern:0,"export":0,mistak:0,proper:0,insensit:0,assertnotequ:0,toto:0,mathemat:0,testname2:0,select:0,testname1:0,pattern:0,asserterrormsgmatch:0,usag:0,maven:0,repositori:0,comparison:0,about:0,actual:0,slightli:0,dispali:0,issu:0,use_expected_actual_in_assert_equ:0,testdiverror:0,own:0,"float":0,two:0,assertisuserdata:0,strip:0,assertnil:0,log:0,wai:0,test1_withfailur:0,custom:0,avail:0,strict:0,"0x29ab56":0,arithmet:0,lot:0,suit:0,testaddposit:0,assertnoti:0,fork:0,forc:0,assertisthread:0,assertisnil:0,"true":0,bug:0,succe:0,possibl:0,"default":0,displai:0,stacktrac:0,assertnotstricontain:0,rerun:0,problem:0,featur:0,creat:0,dure:0,deep:0,"char":0,exist:0,file:0,check:0,appveyor:0,detail:0,other:0,ignor:0,you:0,legitim:0,repeat:0,why:0,consid:0,"0x27ab23":0,receiv:0,longer:0,rule:0,text:0,time:0,escap:0},objtypes:{"0":"py:function"},objnames:{"0":["py","function","Python function"]},filenames:["index"],titles:["Welcome to LuaUnit’s documentation!"],objects:{"":{assertNil:[0,0,1,""],assertNotStrIContains:[0,0,1,""],assertNotEquals:[0,0,1,""],assertNotAlmostEquals:[0,0,1,""],assertIsFunction:[0,0,1,""],assertItemsEquals:[0,0,1,""],assertIsUserdata:[0,0,1,""],assertNotIs:[0,0,1,""],assertIsBoolean:[0,0,1,""],assertErrorMsgEquals:[0,0,1,""],assertStrMatches:[0,0,1,""],assertIsCoroutine:[0,0,1,""],assertIsTable:[0,0,1,""],assertAlmostEquals:[0,0,1,""],assertIsNumber:[0,0,1,""],assertTrue:[0,0,1,""],assertErrorMsgMatches:[0,0,1,""],assertEquals:[0,0,1,""],assertNotNil:[0,0,1,""],assertError:[0,0,1,""],assertIsThread:[0,0,1,""],assertStrContains:[0,0,1,""],assertIs:[0,0,1,""],assertIsString:[0,0,1,""],assertIsNil:[0,0,1,""],assertErrorMsgContains:[0,0,1,""],assertStrIContains:[0,0,1,""],assertNotStrContains:[0,0,1,""],assertFalse:[0,0,1,""]}},titleterms:{set:0,runsuit:0,modul:0,global:0,tabl:0,your:0,option:0,index:0,develop:0,welcom:0,platform:0,teardown:0,support:0,luaunit:0,write:0,start:0,version:0,conclus:0,test:0,"new":0,document:0,type:0,oct:0,refer:0,"function":0,run:0,string:0,get:0,jun:0,jul:0,assert:0,print:0,annex:0,group:0,line:0,valu:0,introduct:0,search:0,nov:0,enabl:0,level:0,setup:0,changelog:0,equal:0,script:0,command:0,error:0,more:0,page:0}})luaunit-3.1/doc/html/_sources/0000777000000000000000000000000012477651667014550 5ustar 00000000000000luaunit-3.1/doc/html/_sources/index.txt0000666000000000000000000010012112477651646016410 0ustar 00000000000000.. LuaUnit documentation master file, created by sphinx-quickstart on Thu Aug 21 21:45:55 2014. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Welcome to LuaUnit's documentation! ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, .. toctree:: :maxdepth: 2 .. highlight:: lua Introduction ************ LuaUnit is a unit-testing framework for Lua. It allows you to write test functions and test classes with test methods, combined with setup/teardown functionality. A wide range of assertions are supported. LuaUnit supports several output format, like Junit or TAP, for easier integration into Continuous Integration platforms (Jenkins, Maven, ...) . The integrated command-line options provide a flexible interface to select tests by name or patterns, control output format, set verbosity, ... Platform support ================ LuaUnit works with Lua 5.1 and 5.2 . It is tested on Windows XP, Windows Server 2003 and Ubuntu 14.04 (see continuous build results on `Travis-CI`_ and `AppVeyor`_ ) and should work on all platforms supported by lua. It has no other dependency than lua itself. .. _Travis-CI: https://travis-ci.org/bluebird75/luaunit .. _AppVeyor: https://ci.appveyor.com/project/bluebird75/luaunit/history LuaUnit is packed into a single-file. To make start using it, just add the file to your project. Development =========== LuaUnit is developed on `Github`_. .. _Github: https://github.com/bluebird75/luaunit Bugs or feature requests should be reported using `GitHub issues`_. .. _Github issues: https://github.com/bluebird75/luaunit/issues Usage and development may be discussed on `LuaUnit mailing-list`_ . If you are using LuaUnit for your project, please drop us an note. .. _LuaUnit mailing-list: http://lists.freehackers.org/list/luaunit%40freehackers.org/ It is released under the BSD license. This documentation is available at `Read-the-docs`_. .. _Read-the-docs: http://luaunit.readthedocs.org/en/latest/ Version and Changelog ===================== This documentation describes the functionality of LuaUnit v3.1 . New in version 3.1 ------------------ * luaunit no longer pollutes global namespace, unless defining EXPORT_ASSERT_TO_GLOBALS to true * fixes and validation of JUnit XML generation * strip luaunit internal information from stacktrace * general improvements of test results with duration and other details * improve printing for tables, with an option to always print table id * fix printing of recursive tables **Important note when upgrading to version 3.1** : assertions functions are no longer exported directly to the global namespace. See :ref:`luaunit-global-asserts` New in version 3.0 - 9 oct 2014 -------------------------------- Because LuaUnit was forked and released as some 2.x version, version number is now jumping to 3.0 . * full documentation available in text, html and pdf at read-the-docs.org * new output format: JUnit, compatible with Bamboo and other CI platforms * much better table assertions * new assertions for strings, with patterns and case insensitivity: assertStrContains, assertNotStrContains, assertNotStrIContains, assertStrIContains, assertStrMatches * new assertions for floats: assertAlmostEquals, assertNotAlmostEquals * type assertions: assertIsString, assertIsNumber, ... * error assertions: assertErrorMsgEquals, assertErrorMsgContains, assertErrorMsgMatches * improved error messages for several assertions * command-line options to select test, control output type and verbosity New in version 1.5 - 8. Nov 2012 -------------------------------- * compatibility with Lua 5.1 and 5.2 * better object model internally * a lot more of internal tests * several internal bug fixes * make it easy to customize the test output * running test functions no longer requires a wrapper * several level of verbosity New in version 1.4 - 26. Jul 2012 --------------------------------- * switch from X11 to more popular BSD license * add TAP output format for integration into Jenkins * official repository now on github New in version 1.3 - 30. Oct 2007 --------------------------------- * port to lua 5.1 * iterate over the test classes, methods and functions in the alphabetical order * change the default order of expected, actual in assertEquals (adjustable with USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS). Version 1.2 - 13. Jun 2005 --------------------------------- * first public release Version 1.1 ------------ * move global variables to internal variables * assertion order is configurable between expected/actual or actual/expected * new assertion to check that a function call returns an error * display the calling stack when an error is spotted * two verbosity level, like in python unittest Getting started *************** Setting up your test script =========================== To get started, create your file *test_something.lua* . The script should import LuaUnit:: luaunit = require('luaunit') The last line executes your script with LuaUnit and exit with the proper error code:: os.exit( luaunit.LuaUnit.run() ) Now, run your file with:: lua test_something.lua It prints something like:: Ran 0 tests in 0 seconds OK Now, your testing framework is in place, you can start writing tests. Writing tests ============= LuaUnit scans all variables that start with *test* or *Test*. If they are functions, or if they are tables that contain functions that start with *test* or *Test*, they are run as part of the test suite. So just write a function whose name starts with test. Inside test functions, use the assertions functions provided by LuaUnit, such as :func:`assertEquals`. Let's see that in practice. Suppose you want to test the following add function:: function add(v1,v2) -- add positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only add positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1+v2 end You write the following tests:: function testAddPositive() luaunit.assertEquals(add(1,1),2) end function testAddZero() luaunit.assertEquals(add(1,0),0) luaunit.assertEquals(add(0,5),0) luaunit.assertEquals(add(0,0),0) end :func:`assertEquals` is the most common used assertion function. It simply verifies that both argument are equals, in the order actual value, expected value. Rerun your test script (-v is to activate a more verbose output) :: lua test_something.lua -v It now prints:: Started on 03/10/15 16:45:41 TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok ========================================================= Ran 2 tests in 0.010 seconds OK You always have: * the date at which the test suite was started * the group to which the function belongs (usually, the name of the function table, and ** for all direct test functions) * the name of the function being executed * a report at the end, with number of executed test, number of non selected tests, number of failures and duration. You also want to test that when the function receives negative numbers, it generates an error. Use :func:`assertError` or even better, :func:`assertErrorMsgContains` to also validate the content of the error message. There are other types or error checking functions, see :ref:`assert-error` . Here we use :func:`assertErrorMsgContains` . First argument is the expected message, then the function to call and the optional arguments:: function testAddError() luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3) end Now, suppose we also have the following function to test:: function adder(v) -- return a function that adds v to its argument using add function closure( x ) return x+v end return closure end We want to test the type of the value returned by adder and its behavior. LuaUnit provides assertion for type testing (see :ref:`assert-type`). In this case, we use :func:`assertIsFunction`:: function testAdder() f = adder(3) luaunit.assertIsFunction( f ) luaunit.assertEquals( f(2), 5 ) end Grouping tests, setup/teardown functionality ===================================================== When the number of tests starts to grow, you usually organise them into separate groups. You can do that with LuaUnit by putting them inside a table (whose name must start with *Test* or *test* ). For example, assume we have a second function to test:: function div(v1,v2) -- divide positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only divide positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1/v2 end We move the tests related to the function add into their own table:: TestAdd = {} function TestAdd:testAddPositive() luaunit.assertEquals(add(1,1),2) end function TestAdd:testAddZero() luaunit.assertEquals(add(1,0),0) luaunit.assertEquals(add(0,5),0) luaunit.assertEquals(add(0,0),0) end function TestAdd:testAddError() luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3) end function TestAdd:testAdder() f = adder(3) luaunit.assertIsFunction( f ) luaunit.assertEquals( f(2), 5 ) end -- end of table TestAdd Then we create a second set of tests for div:: TestDiv = {} function TestDiv:testDivPositive() luaunit.assertEquals(div(4,2),2) end function TestDiv:testDivZero() luaunit.assertEquals(div(4,0),0) luaunit.assertEquals(div(0,5),0) luaunit.assertEquals(div(0,0),0) end function TestDiv:testDivError() luaunit.assertErrorMsgContains('Can only divide positive or null numbers, received 2 and -3', div, 2, -3) end -- end of table TestDiv Execution of the test suite now looks like this:: Started on 03/10/15 16:47:33 TestAdd.testAddError ... Ok TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok TestAdd.testAdder ... Ok TestDiv.testDivError ... Ok TestDiv.testDivPositive ... Ok TestDiv.testDivZero ... Ok ========================================================= Ran 7 tests in 0.010 seconds OK When tests are defined in tables, you can optionally define two special functions, *setUp()* and *tearDown()*, which will be executed respectively before and after every test. These function may be used to create specific resources for the test being executed and cleanup the test environment. For a practical example, imagine that we have a *log()* function that writes strings to a log file on disk. The file is created upon first usage of the function, and the filename is defined by calling the function *initLog()*. The tests for these functions would take advantage of the *setup/teardown* functionality to prepare a log filename shared by all tests, make sure that all tests start with a non existing log file name, and erase the log filename after every test:: TestLogger = {} function TestLogger:setUp() -- define the fname to use for logging self.fname = 'mytmplog.log' -- make sure the file does not already exists os.remove(self.fname) end function TestLogger:testLoggerCreatesFile() initLog(self.fname) log('toto') -- make sure that our log file was created f = io.open(self.fname, 'r') luaunit.assertNotNil( f ) f:close() end function TestLogger:tearDown() -- cleanup our log file after all tests os.remove(self.fname) end .. Note:: *Errors generated during execution of setUp() or tearDown() functions are considered test failures.* Using the command-line ====================== You can control the LuaUnit execution from the command-line: **Output format** Choose the test output format with ``-o`` or ``--output``. Available formats are: * text: the default output format * nil: no output at all * TAP: TAP format * junit: output junit xml Example of non-verbose text format:: $ lua doc/test_something.lua ....... Ran 7 tests in 0.002 seconds OK Example of TAP format:: $ lua doc/test_something.lua -o TAP 1..7 # Started on 03/10/15 16:50:09 # Starting class: TestAdd ok 1 TestAdd.testAddError ok 2 TestAdd.testAddPositive ok 3 TestAdd.testAddZero ok 4 TestAdd.testAdder # Starting class: TestDiv ok 5 TestDiv.testDivError ok 6 TestDiv.testDivPositive ok 7 TestDiv.testDivZero # Ran 7 tests in 0.022 seconds, 7 successes, 0 failures **List of tests to run** You can list some test names on the command-line to run only those tests. The name must be the exact match of either the test table, the test function or the test table and the test method. The option may be repeated. Example:: -- Run all TestAdd table tests and one test of TestDiv table. $ lua doc/test_something.lua TestAdd TestDiv.testDivError -v Started on 03/10/15 16:52:20 TestAdd.testAddError ... Ok TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok TestAdd.testAdder ... Ok TestDiv.testDivError ... Ok ========================================================= Ran 5 tests in 0.000 seconds OK **Filtering tests** The most flexible approach for selecting tests to run is to use a pattern. With ``--pattern`` or ``-p``, you can provide a lua pattern and only the tests that contain the pattern will actually be run. Example:: -- Run all tests of zero testing and error testing -- by using the magic character . lua my_test_suite.lua -v -p Err.r -p Z.ro For our test suite, it gives the following output:: Started on 03/10/15 16:48:29 TestAdd.testAddError ... Ok TestAdd.testAddZero ... Ok TestDiv.testDivError ... Ok TestDiv.testDivZero ... Ok ========================================================= Ran 4 tests in 0.010 seconds OK (ignored=3) The number of tests ignored by the selection is printed, along with the test result. The pattern can be any lua pattern. Be sure to exclude all magic characters with % (like -+?*) and protect your pattern from the shell interpretation by putting it in quotes. Conclusion ========== You now know enough of LuaUnit to start writing your test suite. Check the reference documentation for a complete list of assertions, command-line options and specific behavior. .. _reference-documentation: Reference documentation *********************** .. _luaunit-global-asserts: Enabling global or module-level functions ========================================= Versions of LuaUnit before version 3.1 would export all assertions functions to the global namespace. A typical lua test file would look like this: .. code-block:: lua require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 assertEquals( a , 1 ) -- will fail assertEquals( a , 2 ) end [...] However, this is an obsolete practice in Lua. It is now recommended to keep all functions inside the module. Starting from version 3.1 LuaUnit follows this practice and the code should be adapted to look like this: .. code-block:: lua -- the imported module must be stored luaunit = require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 luaunit.assertEquals( a , 1 ) -- will fail luaunit.assertEquals( a , 2 ) end [...] If you prefer the old way, LuaUnit can continue to export assertions functions if you set the following global variable **prior** to importing LuaUnit: .. code-block:: lua -- this works EXPORT_ASSERT_TO_GLOBALS = true require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 assertEquals( a , 1 ) -- will fail assertEquals( a , 2 ) end [...] .. _luaunit-run: LuaUnit.run() function ====================== **Return value** Normally, you should run your test suite with the following line:: os.exit(luaunit.LuaUnit.run()) The *run()* function returns the number of failures of the test suite. This is good for an exit code, 0 meaning success. **Arguments** If no arguments are supplied, it parses the command-line arguments of the script and interpret them. If arguments are supplied to the function, they are parsed instead of the command-line. It uses the same syntax. Example:: -- execute tests matching the 'withXY' pattern os.exit(luaunit.LuaUnit.run('--pattern', 'withXY')) **Choice of tests** If test names were supplied, only those tests are executed. When test names are supplied, they don't have to start with *test*, they are run anyway. If no test names were supplied, a general test collection process starts under the following rules: * all variable starting with *test* or *Test* are scanned. * if the variable is a function it is collected for testing * if the variable is a table: * all keys starting with *test* or *Test* are collected (provided that they are functions) * keys with name *setUp* and *tearDown* are also collected If one or more pattern were supplied, the test are then filtered according the pattern(s). Only the test that match the pattern(s) are actually executed. **setup and teardown** The function *setUp()* is executed before each test if it exists in the table. The function *tearDown()* is executed after every test if it exists in the table. .. Note:: *tearDown()* is always executed if it exists, even if there was a failure in the test or in the *setUp()* function. Failures in *setUp()* or *tearDown()* are considered as a general test failures. LuaUnit.runSuite() function ============================== If you want to keep the flexibility of the command-line parsing, but want to force some parameters, like the output format, you must use a slightly different syntax:: lu = luaunit.LuaUnit.new() lu:setOutputType("tap") os.exit( lu:runSuite() ) *runSuite()* behaves like *run()* except that it must be started with a LuaUnit instance as first argument, and it will use the LuaUnit instance settings. .. _command-line: Command-line options ==================== Usage: lua [options] [testname1 [testname2] **Test names** When no test names are supplied, all tests are collected. The syntax for supplying test names can be either: name of the function, name of the table or name of the table + '.' + name of the function. Only the supplied tests will be executed. **Selecting output format** Choose the output format with the syntax ``-o FORMAT`` or ``--output FORMAT``. Formats available: * ``text``: the default output format of LuaUnit * ``nil``: no output at all * ``tap``: output compatible with the `Test Anything Protocol`_ * ``junit``: output compatible with the *JUnit xml* format (used by many CI platforms) .. _Test Anything Protocol: http://testanything.org/ .. Warning:: In the JUnit format, a destination filename must be supplied with ``--name`` or ``-n`` **Destination filename** When using the JUnit format, the test suites writes an XML file with the test results. The file name is mandatory and must be supplied with: ``--name FILENAME`` or ``-n FILENAME`` **Selecting tests with patterns** You select a subset of tests by specifying one or more filter patterns, with ``-p PATTERN`` or ``--pattern PATTERN``. The pattern is looked for on the full test name *TestTable.testMethod* . Only the tests that actually match the pattern are selected. When specifying more than one pattern, they are tried one by one until the name matches (OR combination). Make sure you esape magic chars like ``+?-*`` with ``%`` . **Other Options:** * ``-h``, ``--help``: display the command-line help. * ``--version``: display the version information * ``-v``, ``--verbose``: Increase the output verbosity. The exact effect depends on the output format. May be specified multiple times. * ``-q``, ``--quiet``: Set verbosity to minimum. The exact effect depends on the output format. .. _assertions-label: Assertions functions ===================== You will now find the list of all assertion functions. For all functions, When an assertion fails, the failure message tries to be as informative as possible, by displaying the expectation and value that caused the failure. .. Note:: see :More on table printing: to know more about tables. .. _assert-equality: Equality assertions ---------------------- All equality assertions functions take two arguments, in the order *actual value* then *expected value*. Some people are more familiar with the order *expected value* then *actual value*. It is possible to configure LuaUnit to use the opposite order for all equality assertions, by setting up a module variable: .. code-block:: lua luaunit.ORDER_ACTUAL_EXPECTED=false The order only matters for the message that is displayed in case of failures. It does not influence the test itself. .. function:: assertEquals(actual, expected) Assert that two values are equal. For tables, the comparison is a deep comparison : * number of elements must be the same * tables must contain the same keys * each key must contain the same values. The values are also compared recursively with deep comparison. LuaUnit provides other table-related assertions, see :ref:`assert-table` .. function:: assertNotEquals(actual, expected) Assert that two values are different. The assertion fails if the two values are identical. It also uses table deep comparison. .. function:: assertAlmostEquals( actual, expected, margin ) Assert that two floating point numbers are almost equal. When comparing floating point numbers, strict equality does not work. Computer arithmetic is so that an operation that mathematically yields 1.00000000 might yield 0.999999999999 in lua . That's why you need an *almost equals* comparison, where you specify the error margin. .. function:: assertNotAlmostEquals( actual, expected, margin ) Assert that two floating point numbers are not almost equal. .. _assert-value: Value assertions ---------------------- .. function:: assertTrue(value) Assert that a given value compares to true. Lua coercion rules are applied so that values like ``0``, ``""``, ``1.17`` all compare to *true*. .. function:: assertFalse(value) Assert that a given value compares to false. Lua coercion rules are applied so that only *nil* and *false* all compare to *false*. .. function:: assertNil(value) Assert that a given value is *nil* . .. function:: assertNotNil(value) Assert that a given value is not *nil* . Lua coercion rules are applied so that values like ``0``, ``""``, ``false`` all validate the assertion. .. function:: assertIs(actual, expected) Assert that two variables are identical. For string, numbers, boolean and for nil, this gives the same result as :func:`assertEquals` . For the other types, identity means that the two variables refer to the same object. **Example :** .. code-block:: lua s1='toto' s2='to'..'to' t1={1,2} t2={1,2} luaunit.assertIs(s1,s1) -- ok luaunit.assertIs(s1,s2) -- ok luaunit.assertIs(t1,t1) -- ok luaunit.assertIs(t1,t2) -- fail .. function:: assertNotIs(actual, expected) Assert that two variables are not identical, in the sense that they do not refer to the same value. See :func:`assertIs` for more details. .. _assert-string: String assertions -------------------------- Assertions related to string and patterns. .. function:: assertStrContains( str, sub [, useRe] ) Assert that a string contains the given substring or pattern. By default, substring is searched in the string. If *useRe* is provided and is true, *sub* is treated as a pattern which is searched inside the string *str* . .. function:: assertStrIContains( str, sub ) Assert that a string contains the given substring, irrespective of the case. Not that unlike :func:`assertStrcontains`, you can not search for a pattern. .. function:: assertNotStrContains( str, sub, useRe ) Assert that a string does not contain a given substring or pattern. By default, substring is searched in the string. If *useRe* is provided and is true, *sub* is treated as a pattern which is searched inside the string *str* . .. function:: assertNotStrIContains( str, sub ) Assert that a string does not contain the given substring, irrespective of the case. Not that unlike :func:`assertNotStrcontains`, you can not search for a pattern. .. function:: assertStrMatches( str, pattern [, start [, final] ] ) Assert that a string matches the full pattern *pattern*. If *start* and *final* are not provided or are *nil*, the pattern must match the full string, from start to end. The functions allows to specify the expected start and end position of the pattern in the string. .. _assert-error: Error assertions -------------------------- Error related assertions, to verify error generation and error messages. .. function:: assertError( func, ...) Assert that calling functions *func* with the arguments yields an error. If the function does not yield an error, the assertion fails. Note that the error message itself is not checked, which means that this function does not distinguish between the legitimate error that you expect and another error that might be triggered by mistake. The next functions provide a better approach to error testing, by checking explicitly the error message content. .. Note:: When testing LuaUnit, switching from *assertError()* to *assertErrorMsgEquals()* revealed quite a few bugs! .. function:: assertErrorMsgEquals( expectedMsg, func, ... ) Assert that calling function *func* will generate exactly the given error message. If the function does not yield an error, or if the error message is not identical, the assertion fails. Be careful when using this function that error messages usually contain the file name and line number information of where the error was generated. This is usually inconvenient. To ignore the filename and line number information, you can either use a pattern with :func:`assertErrorMsgMatches` or simply check for the message containt with :func:`assertErrorMsgContains` . .. function:: assertErrorMsgContains( partialMsg, func, ... ) Assert that calling function *func* will generate an error message containing *partialMsg* . If the function does not yield an error, or if the expected message is not contained in the error message, the assertion fails. .. function:: assertErrorMsgMatches( expectedPattern, func, ... ) Assert that calling function *func* will generate an error message matching *expectedPattern* . If the function does not yield an error, or if the error message does not match the provided patternm the assertion fails. Note that matching is done from the start to the end of the error message. Be sure to escape magic all magic characters with ``%`` (like ``-+.?*``) . .. _assert-type: Type assertions -------------------------- The following functions all perform type checking on their argument. If the received value is not of the right type, the failure message will contain the expected type, the received type and the received value to help you identify better the problem. .. function:: assertIsNumber(value) Assert that the argument is a number (integer or float) .. function:: assertIsString(value) Assert that the argument is a string. .. function:: assertIsTable(value) Assert that the argument is a table. .. function:: assertIsBoolean(value) Assert that the argument is a boolean. .. function:: assertIsNil(value) Assert that the argument is a nil. .. function:: assertIsFunction(value) Assert that the argument is a function. .. function:: assertIsUserdata(value) Assert that the argument is a userdata. .. function:: assertIsCoroutine(value) Assert that the argument is a coroutine (an object with type *thread* ). .. function:: assertIsThread(value) An alias for :func:`assertIsCoroutine`. .. _assert-table: Table assertions -------------------------- .. function:: assertItemsEquals(actual, expected) Assert that two tables contain the same items, irrespective of their keys. This function is practical for example if you want to compare two lists but where items are not in the same order: .. code-block:: lua luaunit.assertItemsEquals( {1,2,3}, {3,2,1} ) -- assertion succeeds .. The comparison is not recursive on the items: if any of the items are tables, they are compared using table equality (like as in :func:`assertEquals` ), where the key matters. .. code-block:: lua luaunit.assertItemsEquals( {1,{2,3},4}, {4,{3,2,},1} ) -- assertion fails because {2,3} ~= {3,2} ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Annexes ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Annex A: More on table printing ******************************** When asserting tables equality, by default, the table content is printed in case of failures. LuaUnit tries to print tables in a readable format. It is possible to always display the table id along with the content, by setting a module parameter PRINT_TABLE_REF_IN_ERROR_MSG . This helps identifying tables: .. code-block:: lua local t1 = {1,2,3} -- normally, t1 is dispalyed as: "{1,2,3}" -- if setting this: luaunit.PRINT_TABLE_REF_IN_ERROR_MSG = true -- display of table t1 becomes: " {1,2,3}" .. Note :: table loops When displaying table content, it is possible to encounter loops, if for example two table references eachother. In such cases, LuaUnit display the full table content once, along with the table id, and displays only the table id for the looping reference. **Example:** displaying a table with reference loop .. code-block:: lua local t1 = {} local t2 = {} t1.t2 = t2 t1.a = {1,2,3} t2.t1 = t1 -- when displaying table t1: -- table t1 inside t2 is only displayed by its id because t1 is already being displayed -- table t2 is displayed along with its id because it is part of a loop. -- t1: " { a={1,2,3}, t2= {t1=} }" Index and Search page ********************** * :ref:`genindex` * :ref:`search` luaunit-3.1/doc/html/_static/0000777000000000000000000000000012477651667014354 5ustar 00000000000000luaunit-3.1/doc/html/_static/ajax-loader.gif0000666000000000000000000000124112473720032017203 0ustar 00000000000000GIF89aU|NU|l!Created with ajaxload.info! ! NETSCAPE2.0,30Ikc:Nf E1º.`q-[9ݦ9 JkH! ,4N!  DqBQT`1 `LE[|ua C%$*! ,62#+AȐ̔V/cNIBap ̳ƨ+Y2d! ,3b%+2V_ ! 1DaFbR]=08,Ȥr9L! ,2r'+JdL &v`\bThYB)@<&,ȤR! ,3 9tڞ0!.BW1  sa50 m)J! ,2 ٜU]qp`a4AF0` @1Α! ,20IeBԜ) q10ʰPaVڥ ub[;luaunit-3.1/doc/html/_static/basic.css0000666000000000000000000002040412477651667016147 0ustar 00000000000000/* * basic.css * ~~~~~~~~~ * * Sphinx stylesheet -- basic theme. * * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /* -- main layout ----------------------------------------------------------- */ div.clearer { clear: both; } /* -- relbar ---------------------------------------------------------------- */ div.related { width: 100%; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } /* -- sidebar --------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 230px; margin-left: -100%; font-size: 90%; } div.sphinxsidebar ul { list-style: none; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } div.sphinxsidebar #searchbox input[type="submit"] { width: 30px; } img { border: 0; max-width: 100%; } /* -- search page ----------------------------------------------------------- */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li div.context { color: #888; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* -- index page ------------------------------------------------------------ */ table.contentstable { width: 90%; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* -- general index --------------------------------------------------------- */ table.indextable { width: 100%; } table.indextable td { text-align: left; vertical-align: top; } table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } div.modindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } div.genindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } /* -- general body styles --------------------------------------------------- */ a.headerlink { visibility: hidden; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } .field-list ul { padding-left: 1em; } .first { margin-top: 0 !important; } p.rubric { margin-top: 30px; font-weight: bold; } img.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } img.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left; } .align-center { text-align: center; } .align-right { text-align: right; } /* -- sidebars -------------------------------------------------------------- */ div.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px 7px 0 7px; background-color: #ffe; width: 40%; float: right; } p.sidebar-title { font-weight: bold; } /* -- topics ---------------------------------------------------------------- */ div.topic { border: 1px solid #ccc; padding: 7px 7px 0 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* -- admonitions ----------------------------------------------------------- */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } div.admonition dl { margin-bottom: 0; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; } div.body p.centered { text-align: center; margin-top: 25px; } /* -- tables ---------------------------------------------------------------- */ table.docutils { border: 0; border-collapse: collapse; } table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #aaa; } table.field-list td, table.field-list th { border: 0 !important; } table.footnote td, table.footnote th { border: 0 !important; } th { text-align: left; padding-right: 5px; } table.citation { border-left: solid 1px gray; margin-left: 1px; } table.citation td { border-bottom: none; } /* -- other body styles ----------------------------------------------------- */ ol.arabic { list-style: decimal; } ol.loweralpha { list-style: lower-alpha; } ol.upperalpha { list-style: upper-alpha; } ol.lowerroman { list-style: lower-roman; } ol.upperroman { list-style: upper-roman; } dl { margin-bottom: 15px; } dd p { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } dt:target, .highlighted { background-color: #fbe54e; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } .optional { font-size: 1.3em; } .versionmodified { font-style: italic; } .system-message { background-color: #fda; padding: 5px; border: 3px solid red; } .footnote:target { background-color: #ffa; } .line-block { display: block; margin-top: 1em; margin-bottom: 1em; } .line-block .line-block { margin-top: 0; margin-bottom: 0; margin-left: 1.5em; } .guilabel, .menuselection { font-family: sans-serif; } .accelerator { text-decoration: underline; } .classifier { font-style: oblique; } abbr, acronym { border-bottom: dotted 1px; cursor: help; } /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; overflow-y: hidden; /* fixes display issues on Chrome browsers */ } td.linenos pre { padding: 5px 0px; border: 0; background-color: transparent; color: #aaa; } table.highlighttable { margin-left: 0.5em; } table.highlighttable td { padding: 0 0.5em 0 0.5em; } tt.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } tt.descclassname { background-color: transparent; } tt.xref, a tt { background-color: transparent; font-weight: bold; } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } .viewcode-link { float: right; } .viewcode-back { float: right; font-family: sans-serif; } div.viewcode-block:target { margin: -1px -10px; padding: 0 10px; } /* -- math display ---------------------------------------------------------- */ img.math { vertical-align: middle; } div.body div.math p { text-align: center; } span.eqno { float: right; } /* -- printout stylesheet --------------------------------------------------- */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0 !important; width: 100%; } div.sphinxsidebar, div.related, div.footer, #top-link { display: none; } }luaunit-3.1/doc/html/_static/comment-bright.png0000666000000000000000000000665412473720032017767 0ustar 00000000000000PNG  IHDRa OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-bKGD pHYs  tIME 6 B\<IDAT8˅Kh]es1mA`jh[-E(FEaA!bIȐ*BX"؁4)NURZ!Mhjssm؋^-\gg ]o|Ҭ[346>zd ]#8Oݺt{5uIXN!I=@Vf=v1}e>;fvnvxaHrʪJF`D¹WZ]S%S)WAb |0K=So7D~\~q-˟\aMZ,S'*} F`Nnz674U H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-bKGD pHYs  tIME!,IDAT8e_Hu?}s3y˕U2MvQ֊FE.łĊbE$DDZF5b@Q":2{n.s<_ y?mwV@tR`}Z _# _=_@ w^R%6gC-έ(K>| ${} H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-bKGD pHYs  tIME 1;VIDAT8ukU?sg4h`G1 RQܸp%Bn"bЍXJ .4V iZ##T;m!4bP~7r>ιbwc;m;oӍAΆ ζZ^/|s{;yR=9(rtVoG1w#_ө{*E&!(LVuoᲵ‘D PG4 :&~*ݳreu: S-,U^E&JY[P!RB ŖޞʖR@_ȐdBfNvHf"2T]R j'B1ddAak/DIJD D2H&L`&L $Ex,6|~_\P $MH`I=@Z||ttvgcЕWTZ'3rje"ܵx9W> mb|byfFRx{w%DZC$wdցHmWnta(M<~;9]C/_;Տ#}o`zSڷ_>:;x컓?yݩ|}~wam-/7=0S5RP"*֯ IENDB`luaunit-3.1/doc/html/_static/default.css0000666000000000000000000000771012477651667016517 0ustar 00000000000000/* * default.css_t * ~~~~~~~~~~~~~ * * Sphinx stylesheet -- default theme. * * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: sans-serif; font-size: 100%; background-color: #11303d; color: #000; margin: 0; padding: 0; } div.document { background-color: #1c4e63; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 230px; } div.body { background-color: #ffffff; color: #000000; padding: 0 20px 30px 20px; } div.footer { color: #ffffff; width: 100%; padding: 9px 0 9px 0; text-align: center; font-size: 75%; } div.footer a { color: #ffffff; text-decoration: underline; } div.related { background-color: #133f52; line-height: 30px; color: #ffffff; } div.related a { color: #ffffff; } div.sphinxsidebar { } div.sphinxsidebar h3 { font-family: 'Trebuchet MS', sans-serif; color: #ffffff; font-size: 1.4em; font-weight: normal; margin: 0; padding: 0; } div.sphinxsidebar h3 a { color: #ffffff; } div.sphinxsidebar h4 { font-family: 'Trebuchet MS', sans-serif; color: #ffffff; font-size: 1.3em; font-weight: normal; margin: 5px 0 0 0; padding: 0; } div.sphinxsidebar p { color: #ffffff; } div.sphinxsidebar p.topless { margin: 5px 10px 10px 10px; } div.sphinxsidebar ul { margin: 10px; padding: 0; color: #ffffff; } div.sphinxsidebar a { color: #98dbcc; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } /* -- hyperlink styles ------------------------------------------------------ */ a { color: #355f7c; text-decoration: none; } a:visited { color: #355f7c; text-decoration: none; } a:hover { text-decoration: underline; } /* -- body styles ----------------------------------------------------------- */ div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Trebuchet MS', sans-serif; background-color: #f2f2f2; font-weight: normal; color: #20435c; border-bottom: 1px solid #ccc; margin: 20px -20px 10px -20px; padding: 3px 0 3px 10px; } div.body h1 { margin-top: 0; font-size: 200%; } div.body h2 { font-size: 160%; } div.body h3 { font-size: 140%; } div.body h4 { font-size: 120%; } div.body h5 { font-size: 110%; } div.body h6 { font-size: 100%; } a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } a.headerlink:hover { background-color: #c60f0f; color: white; } div.body p, div.body dd, div.body li { text-align: justify; line-height: 130%; } div.admonition p.admonition-title + p { display: inline; } div.admonition p { margin-bottom: 5px; } div.admonition pre { margin-bottom: 5px; } div.admonition ul, div.admonition ol { margin-bottom: 5px; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } div.warning { background-color: #ffe4e4; border: 1px solid #f66; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre { padding: 5px; background-color: #eeffcc; color: #333333; line-height: 120%; border: 1px solid #ac9; border-left: none; border-right: none; } tt { background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; } th { background-color: #ede; } .warning tt { background: #efc2c2; } .note tt { background: #d6d6d6; } .viewcode-back { font-family: sans-serif; } div.viewcode-block:target { background-color: #f4debf; border-top: 1px solid #ac9; border-bottom: 1px solid #ac9; }luaunit-3.1/doc/html/_static/doctools.js0000666000000000000000000001503012473720032016512 0ustar 00000000000000/* * doctools.js * ~~~~~~~~~~~ * * Sphinx JavaScript utilities for all documentation. * * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * select a different prefix for underscore */ $u = _.noConflict(); /** * make the code below compatible with browsers without * an installed firebug like debugger if (!window.console || !console.firebug) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; } */ /** * small helper function to urldecode strings */ jQuery.urldecode = function(x) { return decodeURIComponent(x).replace(/\+/g, ' '); }; /** * small helper function to urlencode strings */ jQuery.urlencode = encodeURIComponent; /** * This function returns the parsed url parameters of the * current request. Multiple values per key are supported, * it will always return arrays of strings for the value parts. */ jQuery.getQueryParameters = function(s) { if (typeof s == 'undefined') s = document.location.search; var parts = s.substr(s.indexOf('?') + 1).split('&'); var result = {}; for (var i = 0; i < parts.length; i++) { var tmp = parts[i].split('=', 2); var key = jQuery.urldecode(tmp[0]); var value = jQuery.urldecode(tmp[1]); if (key in result) result[key].push(value); else result[key] = [value]; } return result; }; /** * highlight a given string on a jquery object by wrapping it in * span elements with the given class name. */ jQuery.fn.highlightText = function(text, className) { function highlight(node) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); node.parentNode.insertBefore(span, node.parentNode.insertBefore( document.createTextNode(val.substr(pos + text.length)), node.nextSibling)); node.nodeValue = val.substr(0, pos); } } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { highlight(this); }); } } return this.each(function() { highlight(this); }); }; /** * Small JavaScript module for the documentation. */ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); }, /** * i18n support */ TRANSLATIONS : {}, PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions // can safely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; if (typeof translated == 'undefined') return string; return (typeof translated == 'string') ? translated : translated[0]; }, ngettext : function(singular, plural, n) { var translated = Documentation.TRANSLATIONS[singular]; if (typeof translated == 'undefined') return (n == 1) ? singular : plural; return translated[Documentation.PLURALEXPR(n)]; }, addTranslations : function(catalog) { for (var key in catalog.messages) this.TRANSLATIONS[key] = catalog.messages[key]; this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); this.LOCALE = catalog.locale; }, /** * add context elements like header anchor links */ addContextElements : function() { $('div[id] > :header:first').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this headline')). appendTo(this); }); $('dt[id]').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this definition')). appendTo(this); }); }, /** * workaround a firefox stupidity */ fixFirefoxAnchorBug : function() { if (document.location.hash && $.browser.mozilla) window.setTimeout(function() { document.location.href += ''; }, 10); }, /** * highlight the search words provided in the url in the text */ highlightSearchWords : function() { var params = $.getQueryParameters(); var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; if (terms.length) { var body = $('div.body'); if (!body.length) { body = $('body'); } window.setTimeout(function() { $.each(terms, function() { body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); $('') .appendTo($('#searchbox')); } }, /** * init the domain index toggle buttons */ initIndexTable : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); $('tr.cg-' + idnum).toggle(); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { togglers.click(); } }, /** * helper function to hide the search marks again */ hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); }, /** * make the url absolute */ makeURL : function(relativeURL) { return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; }, /** * get the current relative url */ getCurrentURL : function() { var path = document.location.pathname; var parts = path.split(/\//); $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { if (this == '..') parts.pop(); }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); } }; // quick alias for translations _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); }); luaunit-3.1/doc/html/_static/down-pressed.png0000666000000000000000000000056012473720032017450 0ustar 00000000000000PNG  IHDRasRGBbKGDC pHYs B(xtIME -vF#IDAT8!OAJ, ++@I vbÿ@W7F HN#48646TMvv޼7Dsax1U q;< E-f)j%po4xF78G>)- EYm4%7YTk-Qa"NWAo-yeq,) Ypt\hqmszG]Nar߶s^l vh\2%0EeRvIENDB`luaunit-3.1/doc/html/_static/down.png0000666000000000000000000000055312473720032016007 0ustar 00000000000000PNG  IHDRasRGBbKGDC pHYs B(xtIME"U{IDAT8ҡNCAJ, ++@4>/U^,~T&3M^^^PM6ٹs*RJa)eG*W<"F Fg78G>q OIp:sAj5GنyD^+yU:p_%G@D|aOs(yM,"msx:.b@D|`Vٟ۲иeKſ/G!IENDB`luaunit-3.1/doc/html/_static/file.png0000666000000000000000000000061012473720032015751 0ustar 00000000000000PNG  IHDRabKGD pHYs  tIME  )TIDAT8˭J@Ir('[ "&xYZ X0!i|_@tD] #xjv YNaEi(əy@D&`6PZk$)5%"z.NA#Aba`Vs_3c,2mj [klvy|!Iմy;v "߮a?A7`c^nk?Bg}TЙD# "RD1yER*6MJ3K_Ut8F~IENDB`luaunit-3.1/doc/html/_static/jquery.js0000666000000000000000000026670512473720032016224 0ustar 00000000000000/*! jQuery v1.8.3 jquery.com | jquery.org/license */ (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);luaunit-3.1/doc/html/_static/minus.png0000666000000000000000000000030712473720032016170 0ustar 00000000000000PNG  IHDR &q pHYs  tIME <8tEXtComment̖RIDATcz(BpipPc |IENDB`luaunit-3.1/doc/html/_static/pygments.css0000666000000000000000000000772512477651667016747 0ustar 00000000000000.highlight .hll { background-color: #ffffcc } .highlight { background: #eeffcc; } .highlight .c { color: #408090; font-style: italic } /* Comment */ .highlight .err { border: 1px solid #FF0000 } /* Error */ .highlight .k { color: #007020; font-weight: bold } /* Keyword */ .highlight .o { color: #666666 } /* Operator */ .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #007020 } /* Comment.Preproc */ .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ .highlight .go { color: #333333 } /* Generic.Output */ .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #0044DD } /* Generic.Traceback */ .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #007020 } /* Keyword.Pseudo */ .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #902000 } /* Keyword.Type */ .highlight .m { color: #208050 } /* Literal.Number */ .highlight .s { color: #4070a0 } /* Literal.String */ .highlight .na { color: #4070a0 } /* Name.Attribute */ .highlight .nb { color: #007020 } /* Name.Builtin */ .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ .highlight .no { color: #60add5 } /* Name.Constant */ .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ .highlight .ne { color: #007020 } /* Name.Exception */ .highlight .nf { color: #06287e } /* Name.Function */ .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #bb60d5 } /* Name.Variable */ .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #208050 } /* Literal.Number.Bin */ .highlight .mf { color: #208050 } /* Literal.Number.Float */ .highlight .mh { color: #208050 } /* Literal.Number.Hex */ .highlight .mi { color: #208050 } /* Literal.Number.Integer */ .highlight .mo { color: #208050 } /* Literal.Number.Oct */ .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ .highlight .sc { color: #4070a0 } /* Literal.String.Char */ .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ .highlight .sx { color: #c65d09 } /* Literal.String.Other */ .highlight .sr { color: #235388 } /* Literal.String.Regex */ .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ .highlight .ss { color: #517918 } /* Literal.String.Symbol */ .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */luaunit-3.1/doc/html/_static/searchtools.js0000666000000000000000000004270212477651667017245 0ustar 00000000000000/* * searchtools.js_t * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilties for the full-text search. * * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * Porter Stemmer */ var Stemmer = function() { var step2list = { ational: 'ate', tional: 'tion', enci: 'ence', anci: 'ance', izer: 'ize', bli: 'ble', alli: 'al', entli: 'ent', eli: 'e', ousli: 'ous', ization: 'ize', ation: 'ate', ator: 'ate', alism: 'al', iveness: 'ive', fulness: 'ful', ousness: 'ous', aliti: 'al', iviti: 'ive', biliti: 'ble', logi: 'log' }; var step3list = { icate: 'ic', ative: '', alize: 'al', iciti: 'ic', ical: 'ic', ful: '', ness: '' }; var c = "[^aeiou]"; // consonant var v = "[aeiouy]"; // vowel var C = c + "[^aeiouy]*"; // consonant sequence var V = v + "[aeiou]*"; // vowel sequence var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 var s_v = "^(" + C + ")?" + v; // vowel in stem this.stemWord = function (w) { var stem; var suffix; var firstch; var origword = w; if (w.length < 3) return w; var re; var re2; var re3; var re4; firstch = w.substr(0,1); if (firstch == "y") w = firstch.toUpperCase() + w.substr(1); // Step 1a re = /^(.+?)(ss|i)es$/; re2 = /^(.+?)([^s])s$/; if (re.test(w)) w = w.replace(re,"$1$2"); else if (re2.test(w)) w = w.replace(re2,"$1$2"); // Step 1b re = /^(.+?)eed$/; re2 = /^(.+?)(ed|ing)$/; if (re.test(w)) { var fp = re.exec(w); re = new RegExp(mgr0); if (re.test(fp[1])) { re = /.$/; w = w.replace(re,""); } } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1]; re2 = new RegExp(s_v); if (re2.test(stem)) { w = stem; re2 = /(at|bl|iz)$/; re3 = new RegExp("([^aeiouylsz])\\1$"); re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re2.test(w)) w = w + "e"; else if (re3.test(w)) { re = /.$/; w = w.replace(re,""); } else if (re4.test(w)) w = w + "e"; } } // Step 1c re = /^(.+?)y$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(s_v); if (re.test(stem)) w = stem + "i"; } // Step 2 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step2list[suffix]; } // Step 3 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step3list[suffix]; } // Step 4 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; re2 = /^(.+?)(s|t)(ion)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); if (re.test(stem)) w = stem; } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1] + fp[2]; re2 = new RegExp(mgr1); if (re2.test(stem)) w = stem; } // Step 5 re = /^(.+?)e$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); re2 = new RegExp(meq1); re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) w = stem; } re = /ll$/; re2 = new RegExp(mgr1); if (re.test(w) && re2.test(w)) { re = /.$/; w = w.replace(re,""); } // and turn initial Y back to y if (firstch == "y") w = firstch.toLowerCase() + w.substr(1); return w; } } /** * Simple result scoring code. */ var Scorer = { // Implement the following function to further tweak the score for each result // The function takes a result array [filename, title, anchor, descr, score] // and returns the new score. /* score: function(result) { return result[4]; }, */ // query matches the full name of an object objNameMatch: 11, // or matches in the last dotted part of the object name objPartialMatch: 6, // Additive scores depending on the priority of the object objPrio: {0: 15, // used to be importantResults 1: 5, // used to be objectResults 2: -5}, // used to be unimportantResults // Used when the priority is not in the mapping. objPrioDefault: 0, // query found in title title: 15, // query found in terms term: 5 }; /** * Search Module */ var Search = { _index : null, _queued_query : null, _pulse_status : -1, init : function() { var params = $.getQueryParameters(); if (params.q) { var query = params.q[0]; $('input[name="q"]')[0].value = query; this.performSearch(query); } }, loadIndex : function(url) { $.ajax({type: "GET", url: url, data: null, dataType: "script", cache: true, complete: function(jqxhr, textstatus) { if (textstatus != "success") { document.getElementById("searchindexloader").src = url; } }}); }, setIndex : function(index) { var q; this._index = index; if ((q = this._queued_query) !== null) { this._queued_query = null; Search.query(q); } }, hasIndex : function() { return this._index !== null; }, deferQuery : function(query) { this._queued_query = query; }, stopPulse : function() { this._pulse_status = 0; }, startPulse : function() { if (this._pulse_status >= 0) return; function pulse() { var i; Search._pulse_status = (Search._pulse_status + 1) % 4; var dotString = ''; for (i = 0; i < Search._pulse_status; i++) dotString += '.'; Search.dots.text(dotString); if (Search._pulse_status > -1) window.setTimeout(pulse, 500); } pulse(); }, /** * perform a search for something (or wait until index is loaded) */ performSearch : function(query) { // create the required interface elements this.out = $('#search-results'); this.title = $('

' + _('Searching') + '

').appendTo(this.out); this.dots = $('').appendTo(this.title); this.status = $('

').appendTo(this.out); this.output = $('
'); } // Prettify the comment rating. comment.pretty_rating = comment.rating + ' point' + (comment.rating == 1 ? '' : 's'); // Make a class (for displaying not yet moderated comments differently) comment.css_class = comment.displayed ? '' : ' moderate'; // Create a div for this comment. var context = $.extend({}, opts, comment); var div = $(renderTemplate(commentTemplate, context)); // If the user has voted on this comment, highlight the correct arrow. if (comment.vote) { var direction = (comment.vote == 1) ? 'u' : 'd'; div.find('#' + direction + 'v' + comment.id).hide(); div.find('#' + direction + 'u' + comment.id).show(); } if (opts.moderator || comment.text != '[deleted]') { div.find('a.reply').show(); if (comment.proposal_diff) div.find('#sp' + comment.id).show(); if (opts.moderator && !comment.displayed) div.find('#cm' + comment.id).show(); if (opts.moderator || (opts.username == comment.username)) div.find('#dc' + comment.id).show(); } return div; } /** * A simple template renderer. Placeholders such as <%id%> are replaced * by context['id'] with items being escaped. Placeholders such as <#id#> * are not escaped. */ function renderTemplate(template, context) { var esc = $(document.createElement('div')); function handle(ph, escape) { var cur = context; $.each(ph.split('.'), function() { cur = cur[this]; }); return escape ? esc.text(cur || "").html() : cur; } return template.replace(/<([%#])([\w\.]*)\1>/g, function() { return handle(arguments[2], arguments[1] == '%' ? true : false); }); } /** Flash an error message briefly. */ function showError(message) { $(document.createElement('div')).attr({'class': 'popup-error'}) .append($(document.createElement('div')) .attr({'class': 'error-message'}).text(message)) .appendTo('body') .fadeIn("slow") .delay(2000) .fadeOut("slow"); } /** Add a link the user uses to open the comments popup. */ $.fn.comment = function() { return this.each(function() { var id = $(this).attr('id').substring(1); var count = COMMENT_METADATA[id]; var title = count + ' comment' + (count == 1 ? '' : 's'); var image = count > 0 ? opts.commentBrightImage : opts.commentImage; var addcls = count == 0 ? ' nocomment' : ''; $(this) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-open' + addcls, id: 'ao' + id }) .append($(document.createElement('img')).attr({ src: image, alt: 'comment', title: title })) .click(function(event) { event.preventDefault(); show($(this).attr('id').substring(2)); }) ) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-close hidden', id: 'ah' + id }) .append($(document.createElement('img')).attr({ src: opts.closeCommentImage, alt: 'close', title: 'close' })) .click(function(event) { event.preventDefault(); hide($(this).attr('id').substring(2)); }) ); }); }; var opts = { processVoteURL: '/_process_vote', addCommentURL: '/_add_comment', getCommentsURL: '/_get_comments', acceptCommentURL: '/_accept_comment', deleteCommentURL: '/_delete_comment', commentImage: '/static/_static/comment.png', closeCommentImage: '/static/_static/comment-close.png', loadingImage: '/static/_static/ajax-loader.gif', commentBrightImage: '/static/_static/comment-bright.png', upArrow: '/static/_static/up.png', downArrow: '/static/_static/down.png', upArrowPressed: '/static/_static/up-pressed.png', downArrowPressed: '/static/_static/down-pressed.png', voting: false, moderator: false }; if (typeof COMMENT_OPTIONS != "undefined") { opts = jQuery.extend(opts, COMMENT_OPTIONS); } var popupTemplate = '\
\

\ Sort by:\ best rated\ newest\ oldest\

\
Comments
\
\ loading comments...
\
    \
    \

    Add a comment\ (markup):

    \
    \ reStructured text markup: *emph*, **strong**, \ ``code``, \ code blocks: :: and an indented block after blank line
    \
    \ \

    \ \ Propose a change ▹\ \ \ Propose a change ▿\ \

    \ \ \ \ \ \
    \
    '; var commentTemplate = '\
    \
    \
    \ \ \ \ \ \ \
    \
    \ \ \ \ \ \ \
    \
    \
    \

    \ <%username%>\ <%pretty_rating%>\ <%time.delta%>\

    \
    <#text#>
    \

    \ \ reply ▿\ proposal ▹\ proposal ▿\ \ \

    \
    \
    <#proposal_diff#>\
            
    \
      \
      \
      \
      \ '; var replyTemplate = '\
    • \
      \
      \ \ \ \ \ \ \
      \
    • '; $(document).ready(function() { init(); }); })(jQuery); $(document).ready(function() { // add comment anchors for all paragraphs that are commentable $('.sphinx-has-comment').comment(); // highlight search words in search results $("div.context").each(function() { var params = $.getQueryParameters(); var terms = (params.q) ? params.q[0].split(/\s+/) : []; var result = $(this); $.each(terms, function() { result.highlightText(this.toLowerCase(), 'highlighted'); }); }); // directly open comment window if requested var anchor = document.location.hash; if (anchor.substring(0, 9) == '#comment-') { $('#ao' + anchor.substring(9)).click(); document.location.hash = '#s' + anchor.substring(9); } }); luaunit-3.1/doc/index.rst0000666000000000000000000010012112477651646013613 0ustar 00000000000000.. LuaUnit documentation master file, created by sphinx-quickstart on Thu Aug 21 21:45:55 2014. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Welcome to LuaUnit's documentation! ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, .. toctree:: :maxdepth: 2 .. highlight:: lua Introduction ************ LuaUnit is a unit-testing framework for Lua. It allows you to write test functions and test classes with test methods, combined with setup/teardown functionality. A wide range of assertions are supported. LuaUnit supports several output format, like Junit or TAP, for easier integration into Continuous Integration platforms (Jenkins, Maven, ...) . The integrated command-line options provide a flexible interface to select tests by name or patterns, control output format, set verbosity, ... Platform support ================ LuaUnit works with Lua 5.1 and 5.2 . It is tested on Windows XP, Windows Server 2003 and Ubuntu 14.04 (see continuous build results on `Travis-CI`_ and `AppVeyor`_ ) and should work on all platforms supported by lua. It has no other dependency than lua itself. .. _Travis-CI: https://travis-ci.org/bluebird75/luaunit .. _AppVeyor: https://ci.appveyor.com/project/bluebird75/luaunit/history LuaUnit is packed into a single-file. To make start using it, just add the file to your project. Development =========== LuaUnit is developed on `Github`_. .. _Github: https://github.com/bluebird75/luaunit Bugs or feature requests should be reported using `GitHub issues`_. .. _Github issues: https://github.com/bluebird75/luaunit/issues Usage and development may be discussed on `LuaUnit mailing-list`_ . If you are using LuaUnit for your project, please drop us an note. .. _LuaUnit mailing-list: http://lists.freehackers.org/list/luaunit%40freehackers.org/ It is released under the BSD license. This documentation is available at `Read-the-docs`_. .. _Read-the-docs: http://luaunit.readthedocs.org/en/latest/ Version and Changelog ===================== This documentation describes the functionality of LuaUnit v3.1 . New in version 3.1 ------------------ * luaunit no longer pollutes global namespace, unless defining EXPORT_ASSERT_TO_GLOBALS to true * fixes and validation of JUnit XML generation * strip luaunit internal information from stacktrace * general improvements of test results with duration and other details * improve printing for tables, with an option to always print table id * fix printing of recursive tables **Important note when upgrading to version 3.1** : assertions functions are no longer exported directly to the global namespace. See :ref:`luaunit-global-asserts` New in version 3.0 - 9 oct 2014 -------------------------------- Because LuaUnit was forked and released as some 2.x version, version number is now jumping to 3.0 . * full documentation available in text, html and pdf at read-the-docs.org * new output format: JUnit, compatible with Bamboo and other CI platforms * much better table assertions * new assertions for strings, with patterns and case insensitivity: assertStrContains, assertNotStrContains, assertNotStrIContains, assertStrIContains, assertStrMatches * new assertions for floats: assertAlmostEquals, assertNotAlmostEquals * type assertions: assertIsString, assertIsNumber, ... * error assertions: assertErrorMsgEquals, assertErrorMsgContains, assertErrorMsgMatches * improved error messages for several assertions * command-line options to select test, control output type and verbosity New in version 1.5 - 8. Nov 2012 -------------------------------- * compatibility with Lua 5.1 and 5.2 * better object model internally * a lot more of internal tests * several internal bug fixes * make it easy to customize the test output * running test functions no longer requires a wrapper * several level of verbosity New in version 1.4 - 26. Jul 2012 --------------------------------- * switch from X11 to more popular BSD license * add TAP output format for integration into Jenkins * official repository now on github New in version 1.3 - 30. Oct 2007 --------------------------------- * port to lua 5.1 * iterate over the test classes, methods and functions in the alphabetical order * change the default order of expected, actual in assertEquals (adjustable with USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS). Version 1.2 - 13. Jun 2005 --------------------------------- * first public release Version 1.1 ------------ * move global variables to internal variables * assertion order is configurable between expected/actual or actual/expected * new assertion to check that a function call returns an error * display the calling stack when an error is spotted * two verbosity level, like in python unittest Getting started *************** Setting up your test script =========================== To get started, create your file *test_something.lua* . The script should import LuaUnit:: luaunit = require('luaunit') The last line executes your script with LuaUnit and exit with the proper error code:: os.exit( luaunit.LuaUnit.run() ) Now, run your file with:: lua test_something.lua It prints something like:: Ran 0 tests in 0 seconds OK Now, your testing framework is in place, you can start writing tests. Writing tests ============= LuaUnit scans all variables that start with *test* or *Test*. If they are functions, or if they are tables that contain functions that start with *test* or *Test*, they are run as part of the test suite. So just write a function whose name starts with test. Inside test functions, use the assertions functions provided by LuaUnit, such as :func:`assertEquals`. Let's see that in practice. Suppose you want to test the following add function:: function add(v1,v2) -- add positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only add positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1+v2 end You write the following tests:: function testAddPositive() luaunit.assertEquals(add(1,1),2) end function testAddZero() luaunit.assertEquals(add(1,0),0) luaunit.assertEquals(add(0,5),0) luaunit.assertEquals(add(0,0),0) end :func:`assertEquals` is the most common used assertion function. It simply verifies that both argument are equals, in the order actual value, expected value. Rerun your test script (-v is to activate a more verbose output) :: lua test_something.lua -v It now prints:: Started on 03/10/15 16:45:41 TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok ========================================================= Ran 2 tests in 0.010 seconds OK You always have: * the date at which the test suite was started * the group to which the function belongs (usually, the name of the function table, and ** for all direct test functions) * the name of the function being executed * a report at the end, with number of executed test, number of non selected tests, number of failures and duration. You also want to test that when the function receives negative numbers, it generates an error. Use :func:`assertError` or even better, :func:`assertErrorMsgContains` to also validate the content of the error message. There are other types or error checking functions, see :ref:`assert-error` . Here we use :func:`assertErrorMsgContains` . First argument is the expected message, then the function to call and the optional arguments:: function testAddError() luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3) end Now, suppose we also have the following function to test:: function adder(v) -- return a function that adds v to its argument using add function closure( x ) return x+v end return closure end We want to test the type of the value returned by adder and its behavior. LuaUnit provides assertion for type testing (see :ref:`assert-type`). In this case, we use :func:`assertIsFunction`:: function testAdder() f = adder(3) luaunit.assertIsFunction( f ) luaunit.assertEquals( f(2), 5 ) end Grouping tests, setup/teardown functionality ===================================================== When the number of tests starts to grow, you usually organise them into separate groups. You can do that with LuaUnit by putting them inside a table (whose name must start with *Test* or *test* ). For example, assume we have a second function to test:: function div(v1,v2) -- divide positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only divide positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1/v2 end We move the tests related to the function add into their own table:: TestAdd = {} function TestAdd:testAddPositive() luaunit.assertEquals(add(1,1),2) end function TestAdd:testAddZero() luaunit.assertEquals(add(1,0),0) luaunit.assertEquals(add(0,5),0) luaunit.assertEquals(add(0,0),0) end function TestAdd:testAddError() luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3) end function TestAdd:testAdder() f = adder(3) luaunit.assertIsFunction( f ) luaunit.assertEquals( f(2), 5 ) end -- end of table TestAdd Then we create a second set of tests for div:: TestDiv = {} function TestDiv:testDivPositive() luaunit.assertEquals(div(4,2),2) end function TestDiv:testDivZero() luaunit.assertEquals(div(4,0),0) luaunit.assertEquals(div(0,5),0) luaunit.assertEquals(div(0,0),0) end function TestDiv:testDivError() luaunit.assertErrorMsgContains('Can only divide positive or null numbers, received 2 and -3', div, 2, -3) end -- end of table TestDiv Execution of the test suite now looks like this:: Started on 03/10/15 16:47:33 TestAdd.testAddError ... Ok TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok TestAdd.testAdder ... Ok TestDiv.testDivError ... Ok TestDiv.testDivPositive ... Ok TestDiv.testDivZero ... Ok ========================================================= Ran 7 tests in 0.010 seconds OK When tests are defined in tables, you can optionally define two special functions, *setUp()* and *tearDown()*, which will be executed respectively before and after every test. These function may be used to create specific resources for the test being executed and cleanup the test environment. For a practical example, imagine that we have a *log()* function that writes strings to a log file on disk. The file is created upon first usage of the function, and the filename is defined by calling the function *initLog()*. The tests for these functions would take advantage of the *setup/teardown* functionality to prepare a log filename shared by all tests, make sure that all tests start with a non existing log file name, and erase the log filename after every test:: TestLogger = {} function TestLogger:setUp() -- define the fname to use for logging self.fname = 'mytmplog.log' -- make sure the file does not already exists os.remove(self.fname) end function TestLogger:testLoggerCreatesFile() initLog(self.fname) log('toto') -- make sure that our log file was created f = io.open(self.fname, 'r') luaunit.assertNotNil( f ) f:close() end function TestLogger:tearDown() -- cleanup our log file after all tests os.remove(self.fname) end .. Note:: *Errors generated during execution of setUp() or tearDown() functions are considered test failures.* Using the command-line ====================== You can control the LuaUnit execution from the command-line: **Output format** Choose the test output format with ``-o`` or ``--output``. Available formats are: * text: the default output format * nil: no output at all * TAP: TAP format * junit: output junit xml Example of non-verbose text format:: $ lua doc/test_something.lua ....... Ran 7 tests in 0.002 seconds OK Example of TAP format:: $ lua doc/test_something.lua -o TAP 1..7 # Started on 03/10/15 16:50:09 # Starting class: TestAdd ok 1 TestAdd.testAddError ok 2 TestAdd.testAddPositive ok 3 TestAdd.testAddZero ok 4 TestAdd.testAdder # Starting class: TestDiv ok 5 TestDiv.testDivError ok 6 TestDiv.testDivPositive ok 7 TestDiv.testDivZero # Ran 7 tests in 0.022 seconds, 7 successes, 0 failures **List of tests to run** You can list some test names on the command-line to run only those tests. The name must be the exact match of either the test table, the test function or the test table and the test method. The option may be repeated. Example:: -- Run all TestAdd table tests and one test of TestDiv table. $ lua doc/test_something.lua TestAdd TestDiv.testDivError -v Started on 03/10/15 16:52:20 TestAdd.testAddError ... Ok TestAdd.testAddPositive ... Ok TestAdd.testAddZero ... Ok TestAdd.testAdder ... Ok TestDiv.testDivError ... Ok ========================================================= Ran 5 tests in 0.000 seconds OK **Filtering tests** The most flexible approach for selecting tests to run is to use a pattern. With ``--pattern`` or ``-p``, you can provide a lua pattern and only the tests that contain the pattern will actually be run. Example:: -- Run all tests of zero testing and error testing -- by using the magic character . lua my_test_suite.lua -v -p Err.r -p Z.ro For our test suite, it gives the following output:: Started on 03/10/15 16:48:29 TestAdd.testAddError ... Ok TestAdd.testAddZero ... Ok TestDiv.testDivError ... Ok TestDiv.testDivZero ... Ok ========================================================= Ran 4 tests in 0.010 seconds OK (ignored=3) The number of tests ignored by the selection is printed, along with the test result. The pattern can be any lua pattern. Be sure to exclude all magic characters with % (like -+?*) and protect your pattern from the shell interpretation by putting it in quotes. Conclusion ========== You now know enough of LuaUnit to start writing your test suite. Check the reference documentation for a complete list of assertions, command-line options and specific behavior. .. _reference-documentation: Reference documentation *********************** .. _luaunit-global-asserts: Enabling global or module-level functions ========================================= Versions of LuaUnit before version 3.1 would export all assertions functions to the global namespace. A typical lua test file would look like this: .. code-block:: lua require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 assertEquals( a , 1 ) -- will fail assertEquals( a , 2 ) end [...] However, this is an obsolete practice in Lua. It is now recommended to keep all functions inside the module. Starting from version 3.1 LuaUnit follows this practice and the code should be adapted to look like this: .. code-block:: lua -- the imported module must be stored luaunit = require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 luaunit.assertEquals( a , 1 ) -- will fail luaunit.assertEquals( a , 2 ) end [...] If you prefer the old way, LuaUnit can continue to export assertions functions if you set the following global variable **prior** to importing LuaUnit: .. code-block:: lua -- this works EXPORT_ASSERT_TO_GLOBALS = true require('luaunit') TestToto = {} --class function TestToto:test1_withFailure() local a = 1 assertEquals( a , 1 ) -- will fail assertEquals( a , 2 ) end [...] .. _luaunit-run: LuaUnit.run() function ====================== **Return value** Normally, you should run your test suite with the following line:: os.exit(luaunit.LuaUnit.run()) The *run()* function returns the number of failures of the test suite. This is good for an exit code, 0 meaning success. **Arguments** If no arguments are supplied, it parses the command-line arguments of the script and interpret them. If arguments are supplied to the function, they are parsed instead of the command-line. It uses the same syntax. Example:: -- execute tests matching the 'withXY' pattern os.exit(luaunit.LuaUnit.run('--pattern', 'withXY')) **Choice of tests** If test names were supplied, only those tests are executed. When test names are supplied, they don't have to start with *test*, they are run anyway. If no test names were supplied, a general test collection process starts under the following rules: * all variable starting with *test* or *Test* are scanned. * if the variable is a function it is collected for testing * if the variable is a table: * all keys starting with *test* or *Test* are collected (provided that they are functions) * keys with name *setUp* and *tearDown* are also collected If one or more pattern were supplied, the test are then filtered according the pattern(s). Only the test that match the pattern(s) are actually executed. **setup and teardown** The function *setUp()* is executed before each test if it exists in the table. The function *tearDown()* is executed after every test if it exists in the table. .. Note:: *tearDown()* is always executed if it exists, even if there was a failure in the test or in the *setUp()* function. Failures in *setUp()* or *tearDown()* are considered as a general test failures. LuaUnit.runSuite() function ============================== If you want to keep the flexibility of the command-line parsing, but want to force some parameters, like the output format, you must use a slightly different syntax:: lu = luaunit.LuaUnit.new() lu:setOutputType("tap") os.exit( lu:runSuite() ) *runSuite()* behaves like *run()* except that it must be started with a LuaUnit instance as first argument, and it will use the LuaUnit instance settings. .. _command-line: Command-line options ==================== Usage: lua [options] [testname1 [testname2] **Test names** When no test names are supplied, all tests are collected. The syntax for supplying test names can be either: name of the function, name of the table or name of the table + '.' + name of the function. Only the supplied tests will be executed. **Selecting output format** Choose the output format with the syntax ``-o FORMAT`` or ``--output FORMAT``. Formats available: * ``text``: the default output format of LuaUnit * ``nil``: no output at all * ``tap``: output compatible with the `Test Anything Protocol`_ * ``junit``: output compatible with the *JUnit xml* format (used by many CI platforms) .. _Test Anything Protocol: http://testanything.org/ .. Warning:: In the JUnit format, a destination filename must be supplied with ``--name`` or ``-n`` **Destination filename** When using the JUnit format, the test suites writes an XML file with the test results. The file name is mandatory and must be supplied with: ``--name FILENAME`` or ``-n FILENAME`` **Selecting tests with patterns** You select a subset of tests by specifying one or more filter patterns, with ``-p PATTERN`` or ``--pattern PATTERN``. The pattern is looked for on the full test name *TestTable.testMethod* . Only the tests that actually match the pattern are selected. When specifying more than one pattern, they are tried one by one until the name matches (OR combination). Make sure you esape magic chars like ``+?-*`` with ``%`` . **Other Options:** * ``-h``, ``--help``: display the command-line help. * ``--version``: display the version information * ``-v``, ``--verbose``: Increase the output verbosity. The exact effect depends on the output format. May be specified multiple times. * ``-q``, ``--quiet``: Set verbosity to minimum. The exact effect depends on the output format. .. _assertions-label: Assertions functions ===================== You will now find the list of all assertion functions. For all functions, When an assertion fails, the failure message tries to be as informative as possible, by displaying the expectation and value that caused the failure. .. Note:: see :More on table printing: to know more about tables. .. _assert-equality: Equality assertions ---------------------- All equality assertions functions take two arguments, in the order *actual value* then *expected value*. Some people are more familiar with the order *expected value* then *actual value*. It is possible to configure LuaUnit to use the opposite order for all equality assertions, by setting up a module variable: .. code-block:: lua luaunit.ORDER_ACTUAL_EXPECTED=false The order only matters for the message that is displayed in case of failures. It does not influence the test itself. .. function:: assertEquals(actual, expected) Assert that two values are equal. For tables, the comparison is a deep comparison : * number of elements must be the same * tables must contain the same keys * each key must contain the same values. The values are also compared recursively with deep comparison. LuaUnit provides other table-related assertions, see :ref:`assert-table` .. function:: assertNotEquals(actual, expected) Assert that two values are different. The assertion fails if the two values are identical. It also uses table deep comparison. .. function:: assertAlmostEquals( actual, expected, margin ) Assert that two floating point numbers are almost equal. When comparing floating point numbers, strict equality does not work. Computer arithmetic is so that an operation that mathematically yields 1.00000000 might yield 0.999999999999 in lua . That's why you need an *almost equals* comparison, where you specify the error margin. .. function:: assertNotAlmostEquals( actual, expected, margin ) Assert that two floating point numbers are not almost equal. .. _assert-value: Value assertions ---------------------- .. function:: assertTrue(value) Assert that a given value compares to true. Lua coercion rules are applied so that values like ``0``, ``""``, ``1.17`` all compare to *true*. .. function:: assertFalse(value) Assert that a given value compares to false. Lua coercion rules are applied so that only *nil* and *false* all compare to *false*. .. function:: assertNil(value) Assert that a given value is *nil* . .. function:: assertNotNil(value) Assert that a given value is not *nil* . Lua coercion rules are applied so that values like ``0``, ``""``, ``false`` all validate the assertion. .. function:: assertIs(actual, expected) Assert that two variables are identical. For string, numbers, boolean and for nil, this gives the same result as :func:`assertEquals` . For the other types, identity means that the two variables refer to the same object. **Example :** .. code-block:: lua s1='toto' s2='to'..'to' t1={1,2} t2={1,2} luaunit.assertIs(s1,s1) -- ok luaunit.assertIs(s1,s2) -- ok luaunit.assertIs(t1,t1) -- ok luaunit.assertIs(t1,t2) -- fail .. function:: assertNotIs(actual, expected) Assert that two variables are not identical, in the sense that they do not refer to the same value. See :func:`assertIs` for more details. .. _assert-string: String assertions -------------------------- Assertions related to string and patterns. .. function:: assertStrContains( str, sub [, useRe] ) Assert that a string contains the given substring or pattern. By default, substring is searched in the string. If *useRe* is provided and is true, *sub* is treated as a pattern which is searched inside the string *str* . .. function:: assertStrIContains( str, sub ) Assert that a string contains the given substring, irrespective of the case. Not that unlike :func:`assertStrcontains`, you can not search for a pattern. .. function:: assertNotStrContains( str, sub, useRe ) Assert that a string does not contain a given substring or pattern. By default, substring is searched in the string. If *useRe* is provided and is true, *sub* is treated as a pattern which is searched inside the string *str* . .. function:: assertNotStrIContains( str, sub ) Assert that a string does not contain the given substring, irrespective of the case. Not that unlike :func:`assertNotStrcontains`, you can not search for a pattern. .. function:: assertStrMatches( str, pattern [, start [, final] ] ) Assert that a string matches the full pattern *pattern*. If *start* and *final* are not provided or are *nil*, the pattern must match the full string, from start to end. The functions allows to specify the expected start and end position of the pattern in the string. .. _assert-error: Error assertions -------------------------- Error related assertions, to verify error generation and error messages. .. function:: assertError( func, ...) Assert that calling functions *func* with the arguments yields an error. If the function does not yield an error, the assertion fails. Note that the error message itself is not checked, which means that this function does not distinguish between the legitimate error that you expect and another error that might be triggered by mistake. The next functions provide a better approach to error testing, by checking explicitly the error message content. .. Note:: When testing LuaUnit, switching from *assertError()* to *assertErrorMsgEquals()* revealed quite a few bugs! .. function:: assertErrorMsgEquals( expectedMsg, func, ... ) Assert that calling function *func* will generate exactly the given error message. If the function does not yield an error, or if the error message is not identical, the assertion fails. Be careful when using this function that error messages usually contain the file name and line number information of where the error was generated. This is usually inconvenient. To ignore the filename and line number information, you can either use a pattern with :func:`assertErrorMsgMatches` or simply check for the message containt with :func:`assertErrorMsgContains` . .. function:: assertErrorMsgContains( partialMsg, func, ... ) Assert that calling function *func* will generate an error message containing *partialMsg* . If the function does not yield an error, or if the expected message is not contained in the error message, the assertion fails. .. function:: assertErrorMsgMatches( expectedPattern, func, ... ) Assert that calling function *func* will generate an error message matching *expectedPattern* . If the function does not yield an error, or if the error message does not match the provided patternm the assertion fails. Note that matching is done from the start to the end of the error message. Be sure to escape magic all magic characters with ``%`` (like ``-+.?*``) . .. _assert-type: Type assertions -------------------------- The following functions all perform type checking on their argument. If the received value is not of the right type, the failure message will contain the expected type, the received type and the received value to help you identify better the problem. .. function:: assertIsNumber(value) Assert that the argument is a number (integer or float) .. function:: assertIsString(value) Assert that the argument is a string. .. function:: assertIsTable(value) Assert that the argument is a table. .. function:: assertIsBoolean(value) Assert that the argument is a boolean. .. function:: assertIsNil(value) Assert that the argument is a nil. .. function:: assertIsFunction(value) Assert that the argument is a function. .. function:: assertIsUserdata(value) Assert that the argument is a userdata. .. function:: assertIsCoroutine(value) Assert that the argument is a coroutine (an object with type *thread* ). .. function:: assertIsThread(value) An alias for :func:`assertIsCoroutine`. .. _assert-table: Table assertions -------------------------- .. function:: assertItemsEquals(actual, expected) Assert that two tables contain the same items, irrespective of their keys. This function is practical for example if you want to compare two lists but where items are not in the same order: .. code-block:: lua luaunit.assertItemsEquals( {1,2,3}, {3,2,1} ) -- assertion succeeds .. The comparison is not recursive on the items: if any of the items are tables, they are compared using table equality (like as in :func:`assertEquals` ), where the key matters. .. code-block:: lua luaunit.assertItemsEquals( {1,{2,3},4}, {4,{3,2,},1} ) -- assertion fails because {2,3} ~= {3,2} ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Annexes ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Annex A: More on table printing ******************************** When asserting tables equality, by default, the table content is printed in case of failures. LuaUnit tries to print tables in a readable format. It is possible to always display the table id along with the content, by setting a module parameter PRINT_TABLE_REF_IN_ERROR_MSG . This helps identifying tables: .. code-block:: lua local t1 = {1,2,3} -- normally, t1 is dispalyed as: "{1,2,3}" -- if setting this: luaunit.PRINT_TABLE_REF_IN_ERROR_MSG = true -- display of table t1 becomes: " {1,2,3}" .. Note :: table loops When displaying table content, it is possible to encounter loops, if for example two table references eachother. In such cases, LuaUnit display the full table content once, along with the table id, and displays only the table id for the looping reference. **Example:** displaying a table with reference loop .. code-block:: lua local t1 = {} local t2 = {} t1.t2 = t2 t1.a = {1,2,3} t2.t1 = t1 -- when displaying table t1: -- table t1 inside t2 is only displayed by its id because t1 is already being displayed -- table t2 is displayed along with its id because it is part of a loop. -- t1: " { a={1,2,3}, t2= {t1=} }" Index and Search page ********************** * :ref:`genindex` * :ref:`search` luaunit-3.1/doc/make.bat0000777000000000000000000001505712477651646013377 0ustar 00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\LuaUnit.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\LuaUnit.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end luaunit-3.1/doc/Makefile0000666000000000000000000001543712477651646013431 0ustar 00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/LuaUnit.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/LuaUnit.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/LuaUnit" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/LuaUnit" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." luaunit-3.1/doc/test_something.lua0000666000000000000000000000510212477651646015514 0ustar 00000000000000 luaunit = require('luaunit') function add(v1,v2) -- add positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only add positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1+v2 end function adder(v) -- return a function that adds v to its argument using add function closure( x ) return x+v end return closure end function div(v1,v2) -- divide positive numbers -- return 0 if any of the numbers are 0 -- error if any of the two numbers are negative if v1 < 0 or v2 < 0 then error('Can only divide positive or null numbers, received '..v1..' and '..v2) end if v1 == 0 or v2 == 0 then return 0 end return v1/v2 end TestAdd = {} function TestAdd:testAddPositive() luaunit.assertEquals(add(1,1),2) end function TestAdd:testAddZero() luaunit.assertEquals(add(1,0),0) luaunit.assertEquals(add(0,5),0) luaunit.assertEquals(add(0,0),0) end function TestAdd:testAddError() luaunit.assertErrorMsgContains('Can only add positive or null numbers, received 2 and -3', add, 2, -3) end function TestAdd:testAdder() f = adder(3) luaunit.assertIsFunction( f ) luaunit.assertEquals( f(2), 5 ) end -- end of table TestAdd TestDiv = {} function TestDiv:testDivPositive() luaunit.assertEquals(div(4,2),2) end function TestDiv:testDivZero() luaunit.assertEquals(div(4,0),0) luaunit.assertEquals(div(0,5),0) luaunit.assertEquals(div(0,0),0) end function TestDiv:testDivError() luaunit.assertErrorMsgContains('Can only divide positive or null numbers, received 2 and -3', div, 2, -3) end --[[ TestLogger = {} function TestLogger:setUp() -- define the fname to use for logging self.fname = 'mytmplog.log' -- make sure the file does not already exists os.remove(self.fname) end function TestLogger:testLoggerCreatesFile() initLog(self.fname) log('toto') f = io.open(self.fname, 'r') luaunit.assertNotNil( f ) f:close() end function TestLogger:tearDown() self.fname = 'mytmplog.log' -- cleanup our log file after all tests os.remove(self.fname) end -- end of table TestDiv ]] os.exit(luaunit.LuaUnit.run())luaunit-3.1/doit.py0000666000000000000000000000620712477651646012530 0ustar 00000000000000import subprocess, sys, os, shutil, os.path, optparse VERSION='3.1' RELEASE_NAME='luaunit-%s' % VERSION RELEASE_DIR='release/' + RELEASE_NAME + '/' TARGET_ZIP=RELEASE_NAME + '.zip' TARGET_TGZ=RELEASE_NAME + '.tgz' REPO_PATH='d:/work/luaunit/luaunit-git/luaunit2/' # LUA50='d:/program/dev/lua/lua50/lua50.exe' LUA51='d:/program/dev/lua/lua51/lua51.exe' LUA52='d:/program/dev/lua/lua52/lua52.exe' ALL_LUA = ( (LUA52, 'lua 5.2'), (LUA51, 'lua 5.1'), # (LUA50, 'lua 5.0'), ) os.environ["nodosfilewarning"] = "1" def report( s ): print '[[[[[[[[[[[[[ %s ]]]]]]]]]]]]]' % s def run_tests(): '''Run tests with all versions of lua''' for lua, luaversion in ALL_LUA: report( 'Running unit-tests tests with %s' % luaversion ) retcode = subprocess.call( [lua, 'run_unit_tests.lua'] ) if retcode != 0: report( 'Invalid retcode when running tests: %d' % retcode ) sys.exit( retcode ) report( 'Running functional tests tests with %s' % luaversion ) retcode = subprocess.call( [lua, 'run_functional_tests.lua'] ) if retcode != 0: report( 'Invalid retcode when running tests: %d' % retcode ) sys.exit( retcode ) report( 'All tests succeed!' ) def run_example(): for lua, luaversion in ALL_LUA: report( 'Running examples with %s' % luaversion ) retcode = subprocess.call( [lua, 'example_with_luaunit.lua'] ) if retcode != 12: report( 'Invalid retcode when running examples: %d' % retcode ) sys.exit( retcode ) report( 'All examples ran!' ) def packageit(): shutil.rmtree('release', True) try: os.mkdir('release') except OSError: pass subprocess.check_call(['d:/program/msysgit/msysgit/bin/git.exe', 'clone', '--no-hardlinks', REPO_PATH, RELEASE_DIR]) os.chdir( RELEASE_DIR ) # Release dir cleanup shutil.rmtree('.git') os.unlink('.gitignore') run_tests() run_example() makedoc() shutil.rmtree('doc/_build') # Packaging os.chdir('..') report('Start packaging') shutil.make_archive(RELEASE_NAME, 'zip', root_dir='.', base_dir=RELEASE_NAME ) shutil.make_archive(RELEASE_NAME, 'gztar', root_dir='.', base_dir=RELEASE_NAME ) report('Zip and tgz ready!') def help(): print( 'Available actions:') for opt in OptToFunc: print '\t%s' % opt def makedoc(): os.chdir('doc') if os.path.exists('html'): shutil.rmtree('html') subprocess.check_call(['make.bat', 'html']) shutil.copytree('_build/html', 'html') os.chdir('..') OptToFunc = { 'runtests' : run_tests, 'runexample' : run_example, 'packageit' : packageit, 'makedoc' : makedoc, 'help' : help, } if __name__ == '__main__': doingNothing = True for arg in sys.argv[1:]: if OptToFunc.has_key(arg): doingNothing = False OptToFunc[arg]() else: print 'No such action :', arg sys.exit(-1) if doingNothing: help() luaunit-3.1/example_with_luaunit.lua0000666000000000000000000000650412477651646016151 0ustar 00000000000000EXPORT_ASSERT_TO_GLOBALS = true require('luaunit') TestToto = {} --class function TestToto:setUp() -- set up tests self.a = 1 self.s = 'hop' self.t1 = {1,2,3} self.t2 = {one=1,two=2,three=3} self.t3 = {1,2,three=3} end function TestToto:test1_withFailure() -- print( "some stuff test 1" ) assertEquals( self.a , 1 ) -- will fail assertEquals( self.a , 2 ) assertEquals( self.a , 2 ) end function TestToto:test2_withFailure() -- print( "some stuff test 2" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) -- will fail assertEquals( self.s , 'bof' ) assertEquals( self.s , 'bof' ) end function TestToto:test3() -- print( "some stuff test 3" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) assertEquals( type(self.a), 'number' ) end function TestToto:test4() -- print( "some stuff test 4" ) assertNotEquals( self.a , 1 ) end function TestToto:test5() -- print( "some stuff test 5" ) assertTrue( self.a ) assertFalse( self.a ) end function TestToto:test6() -- print( "some stuff test 6" ) assertTrue( false ) end function TestToto:test7() -- assertEquals( {1,2}, self.t1 ) -- assertEquals( {1,2}, self.t2 ) assertEquals( {1,2}, self.t3 ) end function TestToto:test8a() -- failure occurs in a submethod self:funcWithError() end function TestToto:test8b() -- failure occurs in a submethod self:funcWithFuncWithError() end function TestToto:funcWithFuncWithError() self:funcWithError() end function TestToto:funcWithError() error('Bouhouhoum error!') end -- class TestToto TestTiti = {} --class function TestTiti:setUp() -- set up tests self.a = 1 self.s = 'hop' -- print( 'TestTiti:setUp' ) end function TestTiti:tearDown() -- some tearDown() code if necessary -- print( 'TestTiti:tearDown' ) end function TestTiti:test1_withFailure() -- print( "some stuff test 1" ) assertEquals( self.a , 1 ) -- will fail assertEquals( self.a , 2 ) assertEquals( self.a , 2 ) end function TestTiti:test2_withFailure() -- print( "some stuff test 2" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) -- will fail assertEquals( self.s , 'bof' ) assertEquals( self.s , 'bof' ) end function TestTiti:test3() -- print( "some stuff test 3" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) end -- class TestTiti -- simple test functions that were written previously can be integrated -- in luaunit too function test1_withFailure() assert( 1 == 1) -- will fail assert( 1 == 2) end function test2_withFailure() assert( 'a' == 'a') -- will fail assert( 'a' == 'b') end function test3() assert( 1 == 1) assert( 'a' == 'a') end lu = LuaUnit.new() lu:setOutputType("tap") os.exit( lu:runSuite() ) luaunit-3.1/junitxml/0000777000000000000000000000000012477651646013064 5ustar 00000000000000luaunit-3.1/junitxml/example-apache-ant.xml0000666000000000000000000000223312477651646017240 0ustar 00000000000000 Detailed failure content Detailed error content bla bla output bla bla bla bla error bla bla luaunit-3.1/junitxml/example-bamboo-1.xml0000666000000000000000000001257712477651646016650 0ustar 00000000000000 ............. junit.framework.AssertionFailedError: Should not have any errors. [Perforce client error:, Connect to server failed; check $P4PORT., TCP connect to keg failed., keg: host unknown.] expected:<0> but was:<4> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:282) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:201) at com.atlassian.bamboo.repository.perforce.PerforceSyncCommandTest.testUsingPerforceWhenNoFilesHaveChanged(PerforceSyncCommandTest.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:242) at org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:216) at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:215) at org.apache.maven.surefire.Surefire.run(Surefire.java:163) at org.apache.maven.surefire.Surefire.run(Surefire.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.SurefireBooter.runTestsInProcess(SurefireBooter.java:313) at org.apache.maven.surefire.SurefireBooter.run(SurefireBooter.java:221) at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:371) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) PerforceSyncCommand.command: /usr/local/bin/p4 luaunit-3.1/junitxml/example-bamboo-2.xml0000666000000000000000000000720312477651646016637 0ustar 00000000000000?xml version="1.0" encoding="UTF-8" ?> luaunit-3.1/junitxml/example-jenkins.xml0000666000000000000000000000226312477651646016703 0ustar 00000000000000 bla bla Detailed failure content Detailed error content bla bla output bla bla bla bla error bla bla luaunit-3.1/junitxml/junit-apache-ant.xsd0000666000000000000000000002211112477651646016731 0ustar 00000000000000 JUnit test result schema for the Apache Ant JUnit and JUnitReport tasks Copyright © 2011, Windy Road Technology Pty. Limited The Apache Ant JUnit XML Schema is distributed under the terms of the GNU Lesser General Public License (LGPL) http://www.gnu.org/licenses/lgpl.html Permission to waive conditions of this license may be requested from Windy Road Support (http://windyroad.org/support). Contains an aggregation of testsuite results Derived from testsuite/@name in the non-aggregated documents Starts at '0' for the first testsuite and is incremented by 1 for each following testsuite Contains the results of exexuting a testsuite Properties (e.g., environment settings) set during test execution Indicates that the test errored. An errored test is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test. Contains as a text node relevant data for the error, e.g., a stack trace The error message. e.g., if a java exception is thrown, the return value of getMessage() The type of error that occured. e.g., if a java execption is thrown the full class name of the exception. Indicates that the test failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals. Contains as a text node relevant data for the failure, e.g., a stack trace The message specified in the assert The type of the assert. Name of the test method Full class name for the class the test method is in. Time taken (in seconds) to execute the test Data that was written to standard out while the test was executed Data that was written to standard error while the test was executed Full class name of the test for non-aggregated testsuite documents. Class name without the package for aggregated testsuites documents when the test was executed. Timezone may not be specified. Host on which the tests were executed. 'localhost' should be used if the hostname cannot be determined. The total number of tests in the suite The total number of tests in the suite that failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals The total number of tests in the suite that errorrd. An errored test is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test. Time taken (in seconds) to execute the tests in the suite luaunit-3.1/junitxml/junit-jenkins.xsd0000666000000000000000000001021712477651646016375 0ustar 00000000000000 luaunit-3.1/junitxml/notes-junit-compatibility.txt0000666000000000000000000000070012477651646020750 0ustar 00000000000000Ant xml schema is much more restrictive than jenkins. Non allowed fields in ant, allowed in jenkins: testsuites: - apache ant forbids all attributes. testsuite: - apache ant forbids attributes: disabled, skipped - apache ant allows elements system-out and system-err, that are in testcase for jenkins testcase: - apache ant forbids attributes: assertions, status - apache ant forbids elements: skipped, system-out, system-err luaunit-3.1/junitxml/XMLJUnitResultFormatter.java.txt0000666000000000000000000002322412477651646021245 0ustar 00000000000000/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.tools.ant.taskdefs.optional.junit; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import java.util.Date; import java.net.InetAddress; import java.net.UnknownHostException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.AssertionFailedError; import junit.framework.Test; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.util.DOMElementWriter; import org.apache.tools.ant.util.DateUtils; import org.apache.tools.ant.util.FileUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; /** * Prints XML output of the test to a specified Writer. * * @see FormatterElement */ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants { private static final double ONE_SECOND = 1000.0; /** constant for unnnamed testsuites/cases */ private static final String UNKNOWN = "unknown"; private static DocumentBuilder getDocumentBuilder() { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (Exception exc) { throw new ExceptionInInitializerError(exc); } } /** * The XML document. */ private Document doc; /** * The wrapper for the whole testsuite. */ private Element rootElement; /** * Element for the current test. */ private Hashtable testElements = new Hashtable(); /** * tests that failed. */ private Hashtable failedTests = new Hashtable(); /** * Timing helper. */ private Hashtable testStarts = new Hashtable(); /** * Where to write the log to. */ private OutputStream out; /** No arg constructor. */ public XMLJUnitResultFormatter() { } /** {@inheritDoc}. */ public void setOutput(OutputStream out) { this.out = out; } /** {@inheritDoc}. */ public void setSystemOutput(String out) { formatOutput(SYSTEM_OUT, out); } /** {@inheritDoc}. */ public void setSystemError(String out) { formatOutput(SYSTEM_ERR, out); } /** * The whole testsuite started. * @param suite the testsuite. */ public void startTestSuite(JUnitTest suite) { doc = getDocumentBuilder().newDocument(); rootElement = doc.createElement(TESTSUITE); String n = suite.getName(); rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n); //add the timestamp final String timestamp = DateUtils.format(new Date(), DateUtils.ISO8601_DATETIME_PATTERN); rootElement.setAttribute(TIMESTAMP, timestamp); //and the hostname. rootElement.setAttribute(HOSTNAME, getHostname()); // Output properties Element propsElement = doc.createElement(PROPERTIES); rootElement.appendChild(propsElement); Properties props = suite.getProperties(); if (props != null) { Enumeration e = props.propertyNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); Element propElement = doc.createElement(PROPERTY); propElement.setAttribute(ATTR_NAME, name); propElement.setAttribute(ATTR_VALUE, props.getProperty(name)); propsElement.appendChild(propElement); } } } /** * get the local hostname * @return the name of the local host, or "localhost" if we cannot work it out */ private String getHostname() { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { return "localhost"; } } /** * The whole testsuite ended. * @param suite the testsuite. * @throws BuildException on error. */ public void endTestSuite(JUnitTest suite) throws BuildException { rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount()); rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount()); rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount()); rootElement.setAttribute( ATTR_TIME, "" + (suite.getRunTime() / ONE_SECOND)); if (out != null) { Writer wri = null; try { wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8")); wri.write("\n"); (new DOMElementWriter()).write(rootElement, wri, 0, " "); } catch (IOException exc) { throw new BuildException("Unable to write log file", exc); } finally { if (wri != null) { try { wri.flush(); } catch (IOException ex) { // ignore } } if (out != System.out && out != System.err) { FileUtils.close(wri); } } } } /** * Interface TestListener. * *

      A new Test is started. * @param t the test. */ public void startTest(Test t) { testStarts.put(t, new Long(System.currentTimeMillis())); } /** * Interface TestListener. * *

      A Test is finished. * @param test the test. */ public void endTest(Test test) { // Fix for bug #5637 - if a junit.extensions.TestSetup is // used and throws an exception during setUp then startTest // would never have been called if (!testStarts.containsKey(test)) { startTest(test); } Element currentTest = null; if (!failedTests.containsKey(test)) { currentTest = doc.createElement(TESTCASE); String n = JUnitVersionHelper.getTestCaseName(test); currentTest.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n); // a TestSuite can contain Tests from multiple classes, // even tests with the same name - disambiguate them. currentTest.setAttribute(ATTR_CLASSNAME, JUnitVersionHelper.getTestCaseClassName(test)); rootElement.appendChild(currentTest); testElements.put(test, currentTest); } else { currentTest = (Element) testElements.get(test); } Long l = (Long) testStarts.get(test); currentTest.setAttribute(ATTR_TIME, "" + ((System.currentTimeMillis() - l.longValue()) / ONE_SECOND)); } /** * Interface TestListener for JUnit <= 3.4. * *

      A Test failed. * @param test the test. * @param t the exception. */ public void addFailure(Test test, Throwable t) { formatError(FAILURE, test, t); } /** * Interface TestListener for JUnit > 3.4. * *

      A Test failed. * @param test the test. * @param t the assertion. */ public void addFailure(Test test, AssertionFailedError t) { addFailure(test, (Throwable) t); } /** * Interface TestListener. * *

      An error occurred while running the test. * @param test the test. * @param t the error. */ public void addError(Test test, Throwable t) { formatError(ERROR, test, t); } private void formatError(String type, Test test, Throwable t) { if (test != null) { endTest(test); failedTests.put(test, test); } Element nested = doc.createElement(type); Element currentTest = null; if (test != null) { currentTest = (Element) testElements.get(test); } else { currentTest = rootElement; } currentTest.appendChild(nested); String message = t.getMessage(); if (message != null && message.length() > 0) { nested.setAttribute(ATTR_MESSAGE, t.getMessage()); } nested.setAttribute(ATTR_TYPE, t.getClass().getName()); String strace = JUnitTestRunner.getFilteredTrace(t); Text trace = doc.createTextNode(strace); nested.appendChild(trace); } private void formatOutput(String type, String output) { Element nested = doc.createElement(type); rootElement.appendChild(nested); nested.appendChild(doc.createCDATASection(output)); } } // XMLJUnitResultFormatter luaunit-3.1/LICENSE.txt0000666000000000000000000000254712477651646013045 0ustar 00000000000000This software is distributed under the BSD License. Copyright (c) 2005-2014, Philippe Fremy All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. luaunit-3.1/luaunit.lua0000666000000000000000000020655312477651646013411 0ustar 00000000000000--[[ luaunit.lua Description: A unit testing framework Homepage: https://github.com/bluebird75/luaunit Development by Philippe Fremy Based on initial work of Ryu, Gwang (http://www.gpgstudy.com/gpgiki/LuaUnit) License: BSD License, see LICENSE.txt Version: 3.0 ]]-- local M={} -- private exported functions (for testing) M.private = {} M.VERSION='3.1' --[[ Some people like assertEquals( actual, expected ) and some people prefer assertEquals( expected, actual ). ]]-- M.ORDER_ACTUAL_EXPECTED = true M.PRINT_TABLE_REF_IN_ERROR_MSG = false M.LINE_LENGTH=80 -- set this to false to debug luaunit local STRIP_LUAUNIT_FROM_STACKTRACE=true M.VERBOSITY_DEFAULT = 10 M.VERBOSITY_LOW = 1 M.VERBOSITY_QUIET = 0 M.VERBOSITY_VERBOSE = 20 -- set EXPORT_ASSERT_TO_GLOBALS to have all asserts visible as global values -- EXPORT_ASSERT_TO_GLOBALS = true -- we need to keep a copy of the script args before it is overriden local cmdline_argv = arg M.USAGE=[[Usage: lua [options] [testname1 [testname2] ... ] Options: -h, --help: Print this help --version: Print version information -v, --verbose: Increase verbosity -q, --quiet: Set verbosity to minimum -o, --output OUTPUT: Set output type to OUTPUT Possible values: text, tap, junit, nil -n, --name NAME: For junit only, mandatory name of xml file -p, --pattern PATTERN: Execute all test names matching the lua PATTERN May be repeated to include severals patterns Make sure you esape magic chars like +? with % testname1, testname2, ... : tests to run in the form of testFunction, TestClass or TestClass.testMethod ]] ---------------------------------------------------------------- -- -- general utility functions -- ---------------------------------------------------------------- local function __genSortedIndex( t ) local sortedIndexStr = {} local sortedIndexInt = {} local sortedIndex = {} for key,_ in pairs(t) do if type(key) == 'string' then table.insert( sortedIndexStr, key ) else table.insert( sortedIndexInt, key ) end end table.sort( sortedIndexInt ) table.sort( sortedIndexStr ) for _,value in ipairs(sortedIndexInt) do table.insert( sortedIndex, value ) end for _,value in ipairs(sortedIndexStr) do table.insert( sortedIndex, value ) end return sortedIndex end M.private.__genSortedIndex = __genSortedIndex -- Contains the keys of the table being iterated, already sorted -- and the last index that has been iterated -- Example: -- t a table on which we iterate -- sortedNextCache[ t ].idx is the sorted index of the table -- sortedNextCache[ t ].lastIdx is the last index used in the sorted index local sortedNextCache = {} local function sortedNext(t, state) -- Equivalent of the next() function of table iteration, but returns the -- keys in the alphabetic order. We use a temporary sorted key table that -- is stored in a global variable. We also store the last index -- used in the iteration to find the next one quickly --print("sortedNext: state = "..tostring(state) ) local key if state == nil then -- the first time, generate the index -- cleanup the previous index, just in case... sortedNextCache[ t ] = nil sortedNextCache[ t ] = { idx=__genSortedIndex( t ), lastIdx=1 } key = sortedNextCache[t].idx[1] return key, t[key] end -- normally, the previous index in the orderedTable is there: local lastIndex = sortedNextCache[ t ].lastIdx if sortedNextCache[t].idx[lastIndex] == state then key = sortedNextCache[t].idx[lastIndex+1] sortedNextCache[ t ].lastIdx = lastIndex+1 else -- strange, we have to find the next value by ourselves key = nil for i = 1,#sortedNextCache[t] do if sortedNextCache[t].idx[i] == state then key = sortedNextCache[t].idx[i+1] sortedNextCache[ t ].lastIdx = i+1 -- break end end end if key then return key, t[key] end -- no more value to return, cleanup sortedNextCache[t] = nil return end M.private.sortedNext = sortedNext local function sortedPairs(t) -- Equivalent of the pairs() function on tables. Allows to iterate -- in sorted order. This works only if the key types are all the same -- and support comparison return sortedNext, t, nil end local function strsplit(delimiter, text) -- Split text into a list consisting of the strings in text, -- separated by strings matching delimiter (which may be a pattern). -- example: strsplit(",%s*", "Anna, Bob, Charlie,Dolores") local list = {} local pos = 1 if string.find("", delimiter, 1, true) then -- this would result in endless loops error("delimiter matches empty string!") end while 1 do local first, last = string.find(text, delimiter, pos, true) if first then -- found? table.insert(list, string.sub(text, pos, first-1)) pos = last+1 else table.insert(list, string.sub(text, pos)) break end end return list end M.private.strsplit = strsplit local function hasNewLine( s ) -- return true if s has a newline return (string.find(s, '\n', 1, true) ~= nil) end M.private.hasNewLine = hasNewLine local function prefixString( prefix, s ) -- Prefix all the lines of s with prefix local t, s2 t = strsplit('\n', s) s2 = prefix..table.concat(t, '\n'..prefix) return s2 end M.private.prefixString = prefixString local function strMatch(s, pattern, start, final ) -- return true if s matches completely the pattern from index start to index end -- return false in every other cases -- if start is nil, matches from the beginning of the string -- if end is nil, matches to the end of the string if start == nil then start = 1 end if final == nil then final = string.len(s) end local foundStart, foundEnd = string.find(s, pattern, start, false) if not foundStart then -- no match return false end if foundStart == start and foundEnd == final then return true end return false end M.private.strMatch = strMatch local function xmlEscape( s ) -- Return s escaped for XML attributes -- escapes table: -- " " -- ' ' -- < < -- > > -- & & local substTable = { { '&', "&" }, { '"', """ }, { "'", "'" }, { '<', "<" }, { '>', ">" }, } for _, v in ipairs( substTable ) do s = string.gsub( s, v[1], v[2] ) end return s end M.private.xmlEscape = xmlEscape local function xmlCDataEscape( s ) -- Return s escaped for CData section -- escapes: "]]>" local s = string.gsub( s, ']]>', ']]>' ) return s end M.private.xmlCDataEscape = xmlCDataEscape local patternLuaunitTrace='(.*[/\\]luaunit%.lua:%d+: .*)' local function isLuaunitInternalLine( s ) -- return true if line of stack trace comes from inside luaunit -- print( 'Matching for luaunit: '..s ) local matchStart, matchEnd, capture = string.find( s, patternLuaunitTrace ) if matchStart then -- print('Match luaunit line') return true end return false end local function stripLuaunitTrace( stackTrace ) --[[ -- Example of a traceback: < [C]: in function 'xpcall' ./luaunit.lua:1449: in function 'protectedCall' ./luaunit.lua:1508: in function 'execOneFunction' ./luaunit.lua:1596: in function 'runSuiteByInstances' ./luaunit.lua:1660: in function 'runSuiteByNames' ./luaunit.lua:1736: in function 'runSuite' example_with_luaunit.lua:140: in main chunk [C]: in ?>> Other example: < [C]: in function 'xpcall' ./luaunit.lua:1517: in function 'protectedCall' ./luaunit.lua:1578: in function 'execOneFunction' ./luaunit.lua:1677: in function 'runSuiteByInstances' ./luaunit.lua:1730: in function 'runSuiteByNames' ./luaunit.lua:1806: in function 'runSuite' example_with_luaunit.lua:140: in main chunk [C]: in ?>> < [C]: in function 'xpcall' luaunit2/luaunit.lua:1532: in function 'protectedCall' luaunit2/luaunit.lua:1591: in function 'execOneFunction' luaunit2/luaunit.lua:1679: in function 'runSuiteByInstances' luaunit2/luaunit.lua:1743: in function 'runSuiteByNames' luaunit2/luaunit.lua:1819: in function 'runSuite' luaunit2/example_with_luaunit.lua:140: in main chunk [C]: in ?>> -- first line is "stack traceback": KEEP -- next line may be luaunit line: REMOVE -- next lines are call in the program under testOk: REMOVE -- next lines are calls from luaunit to call the program under test: KEEP -- Strategy: -- keep first line -- remove lines that are part of luaunit -- kepp lines until we hit a luaunit line ]] -- print( '<<'..stackTrace..'>>' ) local t, ret t = strsplit( '\n', stackTrace ) -- print( prettystr(t) ) local idx=2 -- remove lines that are still part of luaunit while idx <= #t do if isLuaunitInternalLine( t[idx] ) then -- print('Removing : '..t[idx] ) table.remove(t, idx) else break end end -- keep lines until we hit luaunit again while (idx <= #t) and (not isLuaunitInternalLine(t[idx])) do -- print('Keeping : '..t[idx] ) idx = idx+1 end -- remove remaining luaunit lines while idx <= #t do -- print('Removing : '..t[idx] ) table.remove(t, idx) end -- print( prettystr(t) ) ret = table.concat( t, '\n') return ret end M.private.stripLuaunitTrace = stripLuaunitTrace function table.keytostring(k) -- like prettystr but do not enclose with "" if the string is just alphanumerical -- this is better for displaying table keys who are often simple strings if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then return k else return M.prettystr(k) end end function table.tostring( tbl, indentLevel, printTableRefs, recursionTable ) printTableRefs = printTableRefs or M.PRINT_TABLE_REF_IN_ERROR_MSG recursionTable = recursionTable or {} recursionTable[tbl] = true local result, done = {}, {} local dispOnMultLines = false for k, v in ipairs( tbl ) do if recursionTable[v] then -- recursion detected! recursionTable['recursionDetected'] = true table.insert( result, "<"..tostring(v)..">" ) else table.insert( result, M.private.prettystr_sub( v, indentLevel+1, false, printTableRefs, recursionTable ) ) end done[ k ] = true end for k, v in sortedPairs( tbl ) do if not done[ k ] then if recursionTable[v] then -- recursion detected! recursionTable['recursionDetected'] = true table.insert( result, table.keytostring( k ) .. "=" .. "<"..tostring(v)..">" ) else table.insert( result, table.keytostring( k ) .. "=" .. M.private.prettystr_sub( v, indentLevel+1, true, printTableRefs, recursionTable ) ) end end end if printTableRefs then table_ref = "<"..tostring(tbl).."> " else table_ref = '' end local SEP_LENGTH=2 -- ", " local totalLength = 0 for k, v in ipairs( result ) do l = string.len( v ) totalLength = totalLength + l if l > M.LINE_LENGTH-1 then dispOnMultLines = true end end -- adjust with length of separator totalLength = totalLength + SEP_LENGTH * math.max( 0, #result-1) + 2 -- two items need 1 sep, thee items two seps + len of '{}' if totalLength > M.LINE_LENGTH-1 then dispOnMultLines = true end if dispOnMultLines then indentString = string.rep(" ", indentLevel) closingIndentString = string.rep(" ", math.max(0, indentLevel-1) ) result_str = table_ref.."{\n"..indentString .. table.concat( result, ",\n"..indentString ) .. "\n"..closingIndentString.."}" else result_str = table_ref.."{".. table.concat( result, ", " ) .. "}" end return result_str end local function prettystr( v, keeponeline ) --[[ Better string conversion, to display nice variable content: For strings, if keeponeline is set to true, string is displayed on one line, with visible \n * string are enclosed with " by default, or with ' if string contains a " * if table is a class, display class name * tables are expanded ]]-- local recursionTable = {} local s = M.private.prettystr_sub(v, 1, keeponeline, M.PRINT_TABLE_REF_IN_ERROR_MSG, recursionTable) if recursionTable['recursionDetected'] == true and M.PRINT_TABLE_REF_IN_ERROR_MSG == false then -- some table contain recursive references, -- so we must recompute the value by including all table references -- else the result looks like crap recursionTable = {} s = M.private.prettystr_sub(v, 1, keeponeline, true, recursionTable) end return s end M.prettystr = prettystr local function prettystr_sub(v, indentLevel, keeponeline, printTableRefs, recursionTable ) if "string" == type( v ) then if keeponeline then v = string.gsub( v, "\n", "\\n" ) end -- use clever delimiters according to content: -- if string contains ", enclose with ' -- if string contains ', enclose with " if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then return "'" .. v .. "'" end return '"' .. string.gsub(v,'"', '\\"' ) .. '"' end if type(v) == 'table' then --if v.__class__ then -- return string.gsub( tostring(v), 'table', v.__class__ ) --end return table.tostring(v, indentLevel, printTableRefs, recursionTable) end return tostring(v) end M.private.prettystr_sub = prettystr_sub local function _table_contains(t, element) if t then for _, value in pairs(t) do if type(value) == type(element) then if type(element) == 'table' then -- if we wanted recursive items content comparison, we could use -- _is_table_items_equals(v, expected) but one level of just comparing -- items is sufficient if M.private._is_table_equals( value, element ) then return true end else if value == element then return true end end end end end return false end local function _is_table_items_equals(actual, expected ) if (type(actual) == 'table') and (type(expected) == 'table') then for k,v in pairs(actual) do if not _table_contains(expected, v) then return false end end for k,v in pairs(expected) do if not _table_contains(actual, v) then return false end end return true elseif type(actual) ~= type(expected) then return false elseif actual == expected then return true end return false end local function _is_table_equals(actual, expected) if (type(actual) == 'table') and (type(expected) == 'table') then if (#actual ~= #expected) then return false end local k,v for k,v in pairs(actual) do if not _is_table_equals(v, expected[k]) then return false end end for k,v in pairs(expected) do if not _is_table_equals(v, actual[k]) then return false end end return true elseif type(actual) ~= type(expected) then return false elseif actual == expected then return true end return false end M.private._is_table_equals = _is_table_equals ---------------------------------------------------------------- -- -- assertions -- ---------------------------------------------------------------- local function errorMsgEquality(actual, expected) local errorMsg if not M.ORDER_ACTUAL_EXPECTED then expected, actual = actual, expected end local expectedStr = prettystr(expected) local actualStr = prettystr(actual) if type(expected) == 'string' or type(expected) == 'table' then if hasNewLine( expectedStr..actualStr ) then expectedStr = '\n'..expectedStr actualStr = '\n'..actualStr end errorMsg = "expected: "..expectedStr.."\n".. "actual: "..actualStr else errorMsg = "expected: "..expectedStr..", actual: "..actualStr end return errorMsg end function M.assertError(f, ...) -- assert that calling f with the arguments will raise an error -- example: assertError( f, 1, 2 ) => f(1,2) should generate an error local no_error, error_msg = pcall( f, ... ) if not no_error then return end error( "Expected an error when calling function but no error generated", 2 ) end function M.assertTrue(value) if not value then error("expected: true, actual: " ..prettystr(value), 2) end end function M.assertFalse(value) if value then error("expected: false, actual: " ..prettystr(value), 2) end end function M.assertNil(value) if value ~= nil then error("expected: nil, actual: " ..prettystr(value), 2) end end function M.assertNotNil(value) if value == nil then error("expected non nil value, received nil", 2) end end function M.assertEquals(actual, expected) if type(actual) == 'table' and type(expected) == 'table' then if not _is_table_equals(actual, expected) then error( errorMsgEquality(actual, expected), 2 ) end elseif type(actual) ~= type(expected) then error( errorMsgEquality(actual, expected), 2 ) elseif actual ~= expected then error( errorMsgEquality(actual, expected), 2 ) end end function M.assertAlmostEquals( actual, expected, margin ) -- check that two floats are close by margin if type(actual) ~= 'number' or type(expected) ~= 'number' or type(margin) ~= 'number' then error('assertAlmostEquals: must supply only number arguments.\nArguments supplied: '..actual..', '..expected..', '..margin, 2) end if margin < 0 then error( 'assertAlmostEquals: margin must be positive, current value is '..margin, 2) end if not M.ORDER_ACTUAL_EXPECTED then expected, actual = actual, expected end -- help lua in limit cases like assertAlmostEquals( 1.1, 1.0, 0.1) -- which by default does not work. We need to give margin a small boost local realmargin = margin + 0.00000000001 if math.abs(expected - actual) > realmargin then error( 'Values are not almost equal\nExpected: '..expected..' with margin of '..margin..', received: '..actual, 2) end end function M.assertNotEquals(actual, expected) if type(actual) ~= type(expected) then return end local genError = false if type(actual) == 'table' and type(expected) == 'table' then if not _is_table_equals(actual, expected) then return end genError = true elseif actual == expected then genError = true end if genError then error( 'Received the not expected value: ' .. prettystr(actual), 2 ) end end function M.assertNotAlmostEquals( actual, expected, margin ) -- check that two floats are not close by margin if type(actual) ~= 'number' or type(expected) ~= 'number' or type(margin) ~= 'number' then error('assertNotAlmostEquals: must supply only number arguments.\nArguments supplied: '..actual..', '..expected..', '..margin, 2) end if margin <= 0 then error( 'assertNotAlmostEquals: margin must be positive, current value is '..margin, 2) end if not M.ORDER_ACTUAL_EXPECTED then expected, actual = actual, expected end -- help lua in limit cases like assertAlmostEquals( 1.1, 1.0, 0.1) -- which by default does not work. We need to give margin a small boost local realmargin = margin + 0.00000000001 if math.abs(expected - actual) <= realmargin then error( 'Values are almost equal\nExpected: '..expected..' with a difference above margin of '..margin..', received: '..actual, 2) end end function M.assertStrContains( str, sub, useRe ) -- this relies on lua string.find function -- a string always contains the empty string local subType local noUseRe = not useRe if string.find(str, sub, 1, noUseRe) == nil then if noUseRe then subType = 'substring' else subType = 'regexp' end local subPretty = prettystr(sub) local strPretty = prettystr(str) if hasNewLine( subPretty..strPretty ) then subPretty = '\n'..subPretty..'\n' strPretty = '\n'..strPretty end error( 'Error, '..subType..' '..subPretty..' was not found in string '..strPretty, 2) end end function M.assertStrIContains( str, sub ) -- this relies on lua string.find function -- a string always contains the empty string local lstr, lsub, subPretty, strPretty lstr = string.lower(str) lsub = string.lower(sub) if string.find(lstr, lsub, 1, true) == nil then subPretty = prettystr(sub) strPretty = prettystr(str) if hasNewLine( subPretty..strPretty ) then subPretty = '\n'..subPretty..'\n' strPretty = '\n'..strPretty end error( 'Error, substring '..subPretty..' was not found (case insensitively) in string '..strPretty,2) end end function M.assertNotStrContains( str, sub, useRe ) -- this relies on lua string.find function -- a string always contains the empty string local substrType local noUseRe = not useRe if string.find(str, sub, 1, noUseRe) ~= nil then local substrType if noUseRe then substrType = 'substring' else substrType = 'regexp' end local subPretty = prettystr(sub) local strPretty = prettystr(str) if hasNewLine( subPretty..strPretty ) then subPretty = '\n'..subPretty..'\n' strPretty = '\n'..strPretty end error( 'Error, '..substrType..' '..subPretty..' was found in string '..strPretty,2) end end function M.assertNotStrIContains( str, sub ) -- this relies on lua string.find function -- a string always contains the empty string local lstr, lsub lstr = string.lower(str) lsub = string.lower(sub) if string.find(lstr, lsub, 1, true) ~= nil then local subPretty = prettystr(sub) local strPretty = prettystr(str) if hasNewLine( subPretty..strPretty) then subPretty = '\n'..subPretty..'\n' strPretty = '\n'..strPretty end error( 'Error, substring '..subPretty..' was found (case insensitively) in string '..strPretty,2) end end function M.assertStrMatches( str, pattern, start, final ) -- Verify a full match for the string -- for a partial match, simply use assertStrContains with useRe set to true if not strMatch( str, pattern, start, final ) then local patternPretty = prettystr(pattern) local strPretty = prettystr(str) if hasNewLine( patternPretty..strPretty) then patternPretty = '\n'..patternPretty..'\n' strPretty = '\n'..strPretty end error( 'Error, pattern '..patternPretty..' was not matched by string '..strPretty,2) end end function M.assertErrorMsgEquals( expectedMsg, func, ... ) -- assert that calling f with the arguments will raise an error -- example: assertError( f, 1, 2 ) => f(1,2) should generate an error local no_error, error_msg = pcall( func, ... ) if no_error then error( 'No error generated when calling function but expected error: "'..expectedMsg..'"', 2 ) end if not (error_msg == expectedMsg) then if hasNewLine( error_msg..expectedMsg ) then expectedMsg = '\n'..expectedMsg error_msg = '\n'..error_msg end error( 'Exact error message expected: "'..expectedMsg..'"\nError message received: "'..error_msg..'"\n',2) end end function M.assertErrorMsgContains( partialMsg, func, ... ) -- assert that calling f with the arguments will raise an error -- example: assertError( f, 1, 2 ) => f(1,2) should generate an error local no_error, error_msg = pcall( func, ... ) if no_error then error( 'No error generated when calling function but expected error containing: '..prettystr(partialMsg), 2 ) end if not string.find( error_msg, partialMsg, nil, true ) then local partialMsgStr = prettystr(partialMsg) local errorMsgStr = prettystr(error_msg) if hasNewLine(error_msg..partialMsg) then partialMsgStr = '\n'..partialMsgStr errorMsgStr = '\n'..errorMsgStr end error( 'Error message does not contain: '..partialMsgStr..'\nError message received: '..errorMsgStr..'\n',2) end end function M.assertErrorMsgMatches( expectedMsg, func, ... ) -- assert that calling f with the arguments will raise an error -- example: assertError( f, 1, 2 ) => f(1,2) should generate an error local no_error, error_msg = pcall( func, ... ) if no_error then error( 'No error generated when calling function but expected error matching: "'..expectedMsg..'"', 2 ) end if not strMatch( error_msg, expectedMsg ) then if hasNewLine(error_msg..expectedMsg) then expectedMsg = '\n'..expectedMsg error_msg = '\n'..error_msg end error( 'Error message does not match: "'..expectedMsg..'"\nError message received: "'..error_msg..'"\n',2) end end local function errorMsgTypeMismatch( expectedType, actual ) local actualStr = prettystr(actual) if hasNewLine(actualStr) then actualStr = '\n'..actualStr end return "Expected: a "..expectedType..' value, actual: type '..type(actual)..', value '..actualStr end function M.assertIsNumber(value) if type(value) ~= 'number' then error( errorMsgTypeMismatch( 'number', value ), 2 ) end end function M.assertIsString(value) if type(value) ~= "string" then error( errorMsgTypeMismatch( 'string', value ), 2 ) end end function M.assertIsTable(value) if type(value) ~= 'table' then error( errorMsgTypeMismatch( 'table', value ), 2 ) end end function M.assertIsBoolean(value) if type(value) ~= 'boolean' then error( errorMsgTypeMismatch( 'boolean', value ), 2 ) end end function M.assertIsNil(value) if type(value) ~= "nil" then error( errorMsgTypeMismatch( 'nil', value ), 2 ) end end function M.assertIsFunction(value) if type(value) ~= 'function' then error( errorMsgTypeMismatch( 'function', value ), 2 ) end end function M.assertIsUserdata(value) if type(value) ~= 'userdata' then error( errorMsgTypeMismatch( 'userdata', value ), 2 ) end end function M.assertIsCoroutine(value) if type(value) ~= 'thread' then error( errorMsgTypeMismatch( 'thread', value ), 2 ) end end M.assertIsThread = M.assertIsCoroutine function M.assertIs(actual, expected) if not M.ORDER_ACTUAL_EXPECTED then actual, expected = expected, actual end if actual ~= expected then local expectedStr = prettystr(expected) local actualStr = prettystr(actual) if hasNewLine(expectedStr..actualStr) then expectedStr = '\n'..expectedStr..'\n' actualStr = '\n'..actualStr else expectedStr = expectedStr..', ' end error( 'Expected object and actual object are not the same\nExpected: '..expectedStr..'actual: '..actualStr, 2) end end function M.assertNotIs(actual, expected) if not M.ORDER_ACTUAL_EXPECTED then actual, expected = expected, actual end if actual == expected then local expectedStr = prettystr(expected) if hasNewLine(expectedStr) then expectedStr = '\n'..expectedStr end error( 'Expected object and actual object are the same object: '..expectedStr, 2 ) end end function M.assertItemsEquals(actual, expected) -- checks that the items of table expected -- are contained in table actual. Warning, this function -- is at least O(n^2) if not _is_table_items_equals(actual, expected ) then local expectedStr = prettystr(expected) local actualStr = prettystr(actual) if hasNewLine(expectedStr..actualStr) then expectedStr = '\n'..expectedStr actualStr = '\n'..actualStr end error( 'Contents of the tables are not identical:\nExpected: '..expectedStr..'\nActual: '..actualStr, 2 ) end end assert_equals = assertEquals assert_not_equals = assertNotEquals assert_error = assertError assert_true = assertTrue assert_false = assertFalse assert_is_number = assertIsNumber assert_is_string = assertIsString assert_is_table = assertIsTable assert_is_boolean = assertIsBoolean assert_is_nil = assertIsNil assert_is_function = assertIsFunction assert_is = assertIs assert_not_is = assertNotIs if EXPORT_ASSERT_TO_GLOBALS then assertError = M.assertError assertTrue = M.assertTrue assertFalse = M.assertFalse assertNil = M.assertNil assertNotNil = M.assertNotNil assertEquals = M.assertEquals assertAlmostEquals = M.assertAlmostEquals assertNotEquals = M.assertNotEquals assertNotAlmostEquals = M.assertNotAlmostEquals assertStrContains = M.assertStrContains assertStrIContains = M.assertStrIContains assertNotStrContains = M.assertNotStrContains assertNotStrIContains = M.assertNotStrIContains assertStrMatches = M.assertStrMatches assertErrorMsgEquals = M.assertErrorMsgEquals assertErrorMsgContains = M.assertErrorMsgContains assertErrorMsgMatches = M.assertErrorMsgMatches assertIsNumber = M.assertIsNumber assertIsString = M.assertIsString assertIsTable = M.assertIsTable assertIsBoolean = M.assertIsBoolean assertIsNil = M.assertIsNil assertIsFunction = M.assertIsFunction assertIsUserdata = M.assertIsUserdata assertIsCoroutine = M.assertIsCoroutine assertIs = M.assertIs assertNotIs = M.assertNotIs assertItemsEquals = M.assertItemsEquals end ---------------------------------------------------------------- -- -- Ouptutters -- ---------------------------------------------------------------- ---------------------------------------------------------------- -- class TapOutput ---------------------------------------------------------------- local TapOutput = { -- class __class__ = 'TapOutput', runner = nil, result = nil, } local TapOutput_MT = { __index = TapOutput } -- For a good reference for TAP format, check: http://testanything.org/tap-specification.html function TapOutput:new() local t = {} t.verbosity = M.VERBOSITY_LOW setmetatable( t, TapOutput_MT ) return t end function TapOutput:startSuite() print("1.."..self.result.testCount) print('# Started on '..self.result.startDate) end function TapOutput:startClass(className) if className ~= '[TestFunctions]' then print('# Starting class: '..className) end end function TapOutput:startTest(testName) end function TapOutput:addFailure( errorMsg, stackTrace ) print(string.format("not ok %d\t%s", self.result.currentTestNumber, self.result.currentNode.testName )) if self.verbosity > M.VERBOSITY_LOW then print( prefixString( ' ', errorMsg ) ) end if self.verbosity > M.VERBOSITY_DEFAULT then print( prefixString( ' ', stackTrace ) ) end end function TapOutput:endTest(testHasFailure) if not self.result.currentNode:hasFailure() then print(string.format("ok %d\t%s", self.result.currentTestNumber, self.result.currentNode.testName )) end end function TapOutput:endClass() end function TapOutput:endSuite() local t = {} table.insert(t, string.format('# Ran %d tests in %0.3f seconds, %d successes, %d failures', self.result.testCount, self.result.duration, self.result.testCount-self.result.failureCount, self.result.failureCount ) ) if self.result.nonSelectedCount > 0 then table.insert(t, string.format(", %d non selected tests", self.result.nonSelectedCount ) ) end print( table.concat(t) ) return self.result.failureCount end -- class TapOutput end ---------------------------------------------------------------- -- class JUnitOutput ---------------------------------------------------------------- -- See directory junitxml for more information about the junit format local JUnitOutput = { -- class __class__ = 'JUnitOutput', runner = nil, result = nil, } local JUnitOutput_MT = { __index = JUnitOutput } function JUnitOutput:new() local t = {} t.testList = {} t.verbosity = M.VERBOSITY_LOW t.fd = nil t.fname = nil setmetatable( t, JUnitOutput_MT ) return t end function JUnitOutput:startSuite() -- open xml file early to deal with errors if self.fname == nil then error('With Junit, an output filename must be supplied with --name!') end if string.sub(self.fname,-4) ~= '.xml' then self.fname = self.fname..'.xml' end self.fd = io.open(self.fname, "w") if self.fd == nil then error("Could not open file for writing: "..self.fname) end print('# XML output to '..self.fname) print('# Started on '..self.result.startDate) end function JUnitOutput:startClass(className) if className ~= '[TestFunctions]' then print('# Starting class: '..className) end end function JUnitOutput:startTest(testName) print('# Starting test: '..testName) end function JUnitOutput:addFailure( errorMsg, stackTrace ) print('# Failure: '..errorMsg) -- print('# '..stackTrace) end function JUnitOutput:endTest(testHasFailure) end function JUnitOutput:endClass() end function JUnitOutput:endSuite() local t = {} table.insert(t, string.format('# Ran %d tests in %0.3f seconds, %d successes, %d failures', self.result.testCount, self.result.duration, self.result.testCount-self.result.failureCount, self.result.failureCount ) ) if self.result.nonSelectedCount > 0 then table.insert(t, string.format(", %d non selected tests", self.result.nonSelectedCount ) ) end print( table.concat(t) ) -- XML file writing self.fd:write('\n') self.fd:write('\n') self.fd:write(string.format( ' \n', self.result.testCount, self.result.startIsodate, self.result.duration, self.result.failureCount )) self.fd:write(" \n") self.fd:write(string.format(' \n', _VERSION ) ) self.fd:write(string.format(' \n', M.VERSION) ) -- XXX please include system name and version if possible self.fd:write(" \n") for i,node in ipairs(self.result.tests) do self.fd:write(string.format(' \n', node.className, node.testName, node.duration ) ) if node.status ~= M.NodeStatus.PASS then self.fd:write(' \n') self.fd:write(' \n') end self.fd:write(' \n') end -- Next to lines are Needed to validate junit ANT xsd but really not useful in general: self.fd:write(' \n') self.fd:write(' \n') self.fd:write(' \n') self.fd:write('\n') self.fd:close() return self.result.failureCount end -- class TapOutput end ---------------------------------------------------------------- -- class TextOutput ---------------------------------------------------------------- --[[ -- Python Non verbose: For each test: . or F or E If some failed tests: ============== ERROR / FAILURE: TestName (testfile.testclass) --------- Stack trace then -------------- then "Ran x tests in 0.000s" then OK or FAILED (failures=1, error=1) -- Python Verbose: testname (filename.classname) ... ok testname (filename.classname) ... FAIL testname (filename.classname) ... ERROR then -------------- then "Ran x tests in 0.000s" then OK or FAILED (failures=1, error=1) -- Ruby: Started . Finished in 0.002695 seconds. 1 tests, 2 assertions, 0 failures, 0 errors -- Ruby: >> ruby tc_simple_number2.rb Loaded suite tc_simple_number2 Started F.. Finished in 0.038617 seconds. 1) Failure: test_failure(TestSimpleNumber) [tc_simple_number2.rb:16]: Adding doesn't work. <3> expected but was <4>. 3 tests, 4 assertions, 1 failures, 0 errors -- Java Junit .......F. Time: 0,003 There was 1 failure: 1) testCapacity(junit.samples.VectorTest)junit.framework.AssertionFailedError at junit.samples.VectorTest.testCapacity(VectorTest.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) FAILURES!!! Tests run: 8, Failures: 1, Errors: 0 -- Maven # mvn test ------------------------------------------------------- T E S T S ------------------------------------------------------- Running math.AdditionTest Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec <<< FAILURE! Results : Failed tests: testLireSymbole(math.AdditionTest) Tests run: 2, Failures: 1, Errors: 0, Skipped: 0 -- LuaUnit ---- non verbose * display . or F or E when running tests ---- verbose * display test name + ok/fail ---- * blank line * number) ERROR or FAILURE: TestName Stack trace * blank line * number) ERROR or FAILURE: TestName Stack trace then -------------- then "Ran x tests in 0.000s (%d not selected, %d skipped)" then OK or FAILED (failures=1, error=1) ]] local TextOutput = { __class__ = 'TextOutput' } local TextOutput_MT = { -- class __index = TextOutput } function TextOutput:new() local t = {} t.runner = nil t.result = nil t.errorList ={} t.verbosity = M.VERBOSITY_DEFAULT setmetatable( t, TextOutput_MT ) return t end function TextOutput:startSuite() if self.verbosity > M.VERBOSITY_DEFAULT then print( 'Started on '.. self.result.startDate ) end end function TextOutput:startClass(className) -- display nothing when starting a new class end function TextOutput:startTest(testName) if self.verbosity > M.VERBOSITY_DEFAULT then io.stdout:write( " ".. self.result.currentNode.testName.." ... " ) end end function TextOutput:addFailure( errorMsg, stackTrace ) -- nothing end function TextOutput:endTest(testHasFailure) if not testHasFailure then if self.verbosity > M.VERBOSITY_DEFAULT then io.stdout:write("Ok\n") else io.stdout:write(".") end else if self.verbosity > M.VERBOSITY_DEFAULT then io.stdout:write( 'FAIL\n' ) print( self.result.currentNode.msg ) --[[ -- find out when to do this: if self.verbosity > M.VERBOSITY_DEFAULT then print( self.result.currentNode.stackTrace ) end ]] else io.stdout:write("F") end end end function TextOutput:endClass() -- nothing end function TextOutput:displayOneFailedTest( index, failure ) print(index..") "..failure.testName ) print( failure.msg ) print( failure.stackTrace ) print() end function TextOutput:displayFailedTests() if self.result.failureCount == 0 then return end print("Failed tests:") print("-------------") for i,v in ipairs(self.result.failures) do self:displayOneFailedTest( i, v ) end end function TextOutput:endSuite() if self.verbosity > M.VERBOSITY_DEFAULT then print("=========================================================") else print() end self:displayFailedTests() local ignoredString = "" print( string.format("Ran %d tests in %0.3f seconds", self.result.testCount, self.result.duration ) ) if self.result.failureCount == 0 then if self.result.nonSelectedCount > 0 then ignoredString = string.format('(ignored=%d)', self.result.nonSelectedCount ) end print('OK '.. ignoredString) else if self.result.nonSelectedCount > 0 then ignoredString = ', '..ignoredString end print(string.format('FAILED (failures=%d%s)', self.result.failureCount, ignoredString ) ) end end -- class TextOutput end ---------------------------------------------------------------- -- class NilOutput ---------------------------------------------------------------- local function nopCallable() --print(42) return nopCallable end local NilOutput = { __class__ = 'NilOuptut', } local NilOutput_MT = { __index = nopCallable, } function NilOutput:new() local t = {} t.__class__ = 'NilOutput' setmetatable( t, NilOutput_MT ) return t end ---------------------------------------------------------------- -- -- class LuaUnit -- ---------------------------------------------------------------- M.LuaUnit = { outputType = TextOutput, verbosity = M.VERBOSITY_DEFAULT, __class__ = 'LuaUnit' } if EXPORT_ASSERT_TO_GLOBALS then LuaUnit = M.LuaUnit end local LuaUnit_MT = { __index = M.LuaUnit } function M.LuaUnit:new() local t = {} setmetatable( t, LuaUnit_MT ) return t end -----------------[[ Utility methods ]]--------------------- function M.LuaUnit.isFunction(aObject) -- return true if aObject is a function return 'function' == type(aObject) end function M.LuaUnit.isClassMethod(aName) -- return true if aName contains a class + a method name in the form class:method return not not string.find(aName, '.', nil, true ) end function M.LuaUnit.splitClassMethod(someName) -- return a pair className, methodName for a name in the form class:method -- return nil if not a class + method name -- name is class + method local hasMethod, methodName, className hasMethod = string.find(someName, '.', nil, true ) if not hasMethod then return nil end methodName = string.sub(someName, hasMethod+1) className = string.sub(someName,1,hasMethod-1) return className, methodName end function M.LuaUnit.isMethodTestName( s ) -- return true is the name matches the name of a test method -- default rule is that is starts with 'Test' or with 'test' if string.sub(s,1,4):lower() == 'test' then return true end return false end function M.LuaUnit.isTestName( s ) -- return true is the name matches the name of a test -- default rule is that is starts with 'Test' or with 'test' if string.sub(s,1,4):lower() == 'test' then return true end return false end function M.LuaUnit.collectTests() -- return a list of all test names in the global namespace -- that match LuaUnit.isTestName local testNames = {} for k, v in pairs(_G) do if M.LuaUnit.isTestName( k ) then table.insert( testNames , k ) end end table.sort( testNames ) return testNames end function M.LuaUnit.parseCmdLine( cmdLine ) -- parse the command line -- Supported command line parameters: -- --verbose, -v: increase verbosity -- --quiet, -q: silence output -- --output, -o, + name: select output type -- --pattern, -p, + pattern: run test matching pattern, may be repeated -- --name, -n, + fname: name of output file for junit, default to stdout -- [testnames, ...]: run selected test names -- -- Returnsa table with the following fields: -- verbosity: nil, M.VERBOSITY_DEFAULT, M.VERBOSITY_QUIET, M.VERBOSITY_VERBOSE -- output: nil, 'tap', 'junit', 'text', 'nil' -- testNames: nil or a list of test names to run -- pattern: nil or a list of patterns local result = {} local state = nil local SET_OUTPUT = 1 local SET_PATTERN = 2 local SET_FNAME = 3 if cmdLine == nil then return result end local function parseOption( option ) if option == '--help' or option == '-h' then result['help'] = true return end if option == '--version' then result['version'] = true return end if option == '--verbose' or option == '-v' then result['verbosity'] = M.VERBOSITY_VERBOSE return end if option == '--quiet' or option == '-q' then result['verbosity'] = M.VERBOSITY_QUIET return end if option == '--output' or option == '-o' then state = SET_OUTPUT return state end if option == '--name' or option == '-n' then state = SET_FNAME return state end if option == '--pattern' or option == '-p' then state = SET_PATTERN return state end error('Unknown option: '..option,3) end local function setArg( cmdArg, state ) if state == SET_OUTPUT then result['output'] = cmdArg return end if state == SET_FNAME then result['fname'] = cmdArg return end if state == SET_PATTERN then if result['pattern'] then table.insert( result['pattern'], cmdArg ) else result['pattern'] = { cmdArg } end return end error('Unknown parse state: '.. state) end for i, cmdArg in ipairs(cmdLine) do if state ~= nil then setArg( cmdArg, state, result ) state = nil else if cmdArg:sub(1,1) == '-' then state = parseOption( cmdArg ) else if result['testNames'] then table.insert( result['testNames'], cmdArg ) else result['testNames'] = { cmdArg } end end end end if result['help'] then M.LuaUnit.help() end if result['version'] then M.LuaUnit.version() end if state ~= nil then error('Missing argument after '..cmdLine[ #cmdLine ],2 ) end return result end function M.LuaUnit.help() print(M.USAGE) os.exit(0) end function M.LuaUnit.version() print('LuaUnit v'..M.VERSION..' by Philippe Fremy ') os.exit(0) end function M.LuaUnit.patternInclude( patternFilter, expr ) -- check if any of patternFilter is contained in expr. If so, return true. -- return false if None of the patterns are contained in expr -- if patternFilter is nil, return true (no filtering) if patternFilter == nil then return true end for i,pattern in ipairs(patternFilter) do if string.find(expr, pattern) then return true end end return false end --------------[[ Output methods ]]------------------------- local NodeStatus = { -- class __class__ = 'NodeStatus', } M.NodeStatus = NodeStatus local NodeStatus_MT = { __index = NodeStatus } -- values of status NodeStatus.PASS='PASS' NodeStatus.FAIL='FAIL' function NodeStatus:new( number, testName, className ) local t = {} t.number = number t.testName = testName t.className = className self:pass() setmetatable( t, NodeStatus_MT ) return t end function NodeStatus:pass() self.status = self.PASS -- useless but we know it's the field we want to use self.msg = nil self.stackTrace = nil end function NodeStatus:fail(msg, stackTrace) self.status = self.FAIL self.msg = msg self.stackTrace = stackTrace end function NodeStatus:hasFailure() -- print('hasFailure: '..prettystr(self)) return (self.status ~= NodeStatus.PASS) end function M.LuaUnit:startSuite(testCount, nonSelectedCount) self.result = {} self.result.failureCount = 0 self.result.testCount = testCount self.result.nonSelectedCount = nonSelectedCount self.result.currentTestNumber = 0 self.result.currentClassName = "" self.result.currentNode = nil self.result.suiteStarted = true self.result.startTime = os.clock() self.result.startDate = os.date() self.result.startIsodate = os.date('%Y-%m-%dT%H:%M:%S') self.result.patternFilter = self.patternFilter self.result.tests = {} self.result.failures = {} self.outputType = self.outputType or TextOutput self.output = self.outputType:new() self.output.runner = self self.output.result = self.result self.output.verbosity = self.verbosity self.output.fname = self.fname self.output:startSuite() end function M.LuaUnit:startClass( className ) self.result.currentClassName = className self.output:startClass( className ) end function M.LuaUnit:startTest( testName ) self.result.currentTestNumber = self.result.currentTestNumber + 1 self.result.currentNode = NodeStatus:new( self.result.currentTestNumber, testName, self.result.currentClassName ) self.result.currentNode.startTime = os.clock() table.insert( self.result.tests, self.result.currentNode ) self.output:startTest( testName ) end function M.LuaUnit:addFailure( errorMsg, stackTrace ) if self.result.currentNode.status == NodeStatus.PASS then self.result.failureCount = self.result.failureCount + 1 self.result.currentNode:fail( errorMsg, stackTrace ) table.insert( self.result.failures, self.result.currentNode ) end self.output:addFailure( errorMsg, stackTrace ) end function M.LuaUnit:endTest() -- print( 'endTEst() '..prettystr(self.result.currentNode)) -- print( 'endTEst() '..prettystr(self.result.currentNode:hasFailure())) self.result.currentNode.duration = os.clock() - self.result.currentNode.startTime self.result.currentNode.startTime = nil self.output:endTest( self.result.currentNode:hasFailure() ) self.result.currentNode = nil end function M.LuaUnit:endClass() self.output:endClass() end function M.LuaUnit:endSuite() if self.result.suiteStarted == false then error('LuaUnit:endSuite() -- suite was already ended' ) end self.result.duration = os.clock()-self.result.startTime self.result.suiteStarted = false self.output:endSuite() end function M.LuaUnit:setOutputType(outputType) -- default to text -- tap produces results according to TAP format if outputType:upper() == "NIL" then self.outputType = NilOutput return end if outputType:upper() == "TAP" then self.outputType = TapOutput return end if outputType:upper() == "JUNIT" then self.outputType = JUnitOutput return end if outputType:upper() == "TEXT" then self.outputType = TextOutput return end error( 'No such format: '..outputType,2) end function M.LuaUnit:setVerbosity( verbosity ) self.verbosity = verbosity end function M.LuaUnit:setFname( fname ) self.fname = fname end --------------[[ Runner ]]----------------- local SPLITTER = '\n>----------<\n' function M.LuaUnit:protectedCall( classInstance , methodInstance, prettyFuncName) -- if classInstance is nil, this is just a function call -- else, it's method of a class being called. local function err_handler(e) return debug.traceback(e..SPLITTER, 3) end local ok=true, fullErrMsg, stackTrace, errMsg, t if classInstance then -- stupid Lua < 5.2 does not allow xpcall with arguments so let's use a workaround ok, fullErrMsg = xpcall( function () methodInstance(classInstance) end, err_handler ) else ok, fullErrMsg = xpcall( function () methodInstance() end, err_handler ) end if ok then return ok end t = strsplit( SPLITTER, fullErrMsg ) errMsg = t[1] stackTrace = string.sub(t[2],2) if prettyFuncName then -- we do have the real method name, improve the stack trace stackTrace = string.gsub( stackTrace, "in function 'methodInstance'", "in function '"..prettyFuncName.."'") end if STRIP_LUAUNIT_FROM_STACKTRACE then stackTrace = stripLuaunitTrace( stackTrace ) end return ok, errMsg, stackTrace end function M.LuaUnit:execOneFunction(className, methodName, classInstance, methodInstance) -- When executing a test function, className and classInstance must be nil -- When executing a class method, all parameters must be set local ok, errMsg, stackTrace if type(methodInstance) ~= 'function' then error( tostring(methodName)..' must be a function, not '..type(methodInstance)) end if className == nil then className = '[TestFunctions]' prettyFuncName = methodName else prettyFuncName = className..'.'..methodName end if self.lastClassName ~= className then if self.lastClassName ~= nil then self:endClass() end self:startClass( className ) self.lastClassName = className end self:startTest(prettyFuncName) -- run setUp first(if any) if classInstance and self.isFunction( classInstance.setUp ) then ok, errMsg, stackTrace = self:protectedCall( classInstance, classInstance.setUp, className..'.setUp') if not ok then self:addFailure( errMsg, stackTrace ) end end -- run testMethod() if not self.result.currentNode:hasFailure() then ok, errMsg, stackTrace = self:protectedCall( classInstance, methodInstance, prettyFuncName) if not ok then self:addFailure( errMsg, stackTrace ) end end -- lastly, run tearDown(if any) if classInstance and self.isFunction(classInstance.tearDown) then ok, errMsg, stackTrace = self:protectedCall( classInstance, classInstance.tearDown, className..'.tearDown') if not ok then self:addFailure( errMsg, stackTrace ) end end self:endTest() end function M.LuaUnit.expandOneClass( result, className, classInstance ) -- add all test methods of classInstance to result for methodName, methodInstance in sortedPairs(classInstance) do if M.LuaUnit.isFunction(methodInstance) and M.LuaUnit.isMethodTestName( methodName ) then table.insert( result, { className..'.'..methodName, classInstance } ) end end end function M.LuaUnit.expandClasses( listOfNameAndInst ) -- expand all classes (proveded as {className, classInstance}) to a list of {className.methodName, classInstance} -- functions and methods remain untouched local result = {} for i,v in ipairs( listOfNameAndInst ) do name, instance = v[1], v[2] if M.LuaUnit.isFunction(instance) then table.insert( result, { name, instance } ) else if type(instance) ~= 'table' then error( 'Instance must be a table or a function, not a '..type(instance)..', value '..prettystr(instance)) end if M.LuaUnit.isClassMethod( name ) then className, methodName = M.LuaUnit.splitClassMethod( name ) methodInstance = instance[methodName] if methodInstance == nil then error( "Could not find method in class "..tostring(className).." for method "..tostring(methodName) ) end table.insert( result, { name, instance } ) else M.LuaUnit.expandOneClass( result, name, instance ) end end end return result end function M.LuaUnit.applyPatternFilter( patternFilter, listOfNameAndInst ) local included = {} local excluded = {} for i,v in ipairs( listOfNameAndInst ) do name, instance = v[1], v[2] if patternFilter and not M.LuaUnit.patternInclude( patternFilter, name ) then table.insert( excluded, v ) else table.insert( included, v ) end end return included, excluded end function M.LuaUnit:runSuiteByInstances( listOfNameAndInst ) -- Run an explicit list of tests. All test instances and names must be supplied. -- each test must be one of: -- * { function name, function instance } -- * { class name, class instance } -- * { class.method name, class instance } local expandedList, filteredList, filteredOutList, className, methodName, methodInstance expandedList = self.expandClasses( listOfNameAndInst ) filteredList, filteredOutList = self.applyPatternFilter( self.patternFilter, expandedList ) self:startSuite( #filteredList, #filteredOutList ) for i,v in ipairs( filteredList ) do local name, instance = v[1], v[2] if M.LuaUnit.isFunction(instance) then self:execOneFunction( nil, name, nil, instance ) else if type(instance) ~= 'table' then error( 'Instance must be a table or a function, not a '..type(instance)..', value '..prettystr(instance)) else assert( M.LuaUnit.isClassMethod( name ) ) className, methodName = M.LuaUnit.splitClassMethod( name ) methodInstance = instance[methodName] if methodInstance == nil then error( "Could not find method in class "..tostring(className).." for method "..tostring(methodName) ) end self:execOneFunction( className, methodName, instance, methodInstance ) end end end if self.lastClassName ~= nil then self:endClass() end self:endSuite() end function M.LuaUnit:runSuiteByNames( listOfName ) -- Run an explicit list of test names local className, methodName, instanceName, instance, methodInstance local listOfNameAndInst = {} for i,name in ipairs( listOfName ) do if M.LuaUnit.isClassMethod( name ) then className, methodName = M.LuaUnit.splitClassMethod( name ) instanceName = className instance = _G[instanceName] if instance == nil then error( "No such name in global space: "..instanceName ) end if type(instance) ~= 'table' then error( 'Instance of '..instanceName..' must be a table, not '..type(instance)) end methodInstance = instance[methodName] if methodInstance == nil then error( "Could not find method in class "..tostring(className).." for method "..tostring(methodName) ) end else -- for functions and classes instanceName = name instance = _G[instanceName] end if instance == nil then error( "No such name in global space: "..instanceName ) end if (type(instance) ~= 'table' and type(instance) ~= 'function') then error( 'Name must match a function or a table: '..instanceName ) end table.insert( listOfNameAndInst, { name, instance } ) end self:runSuiteByInstances( listOfNameAndInst ) end function M.LuaUnit.run(...) -- Run some specific test classes. -- If no arguments are passed, run the class names specified on the -- command line. If no class name is specified on the command line -- run all classes whose name starts with 'Test' -- -- If arguments are passed, they must be strings of the class names -- that you want to run or generic command line arguments (-o, -p, -v, ...) local runner = M.LuaUnit.new() return runner:runSuite(...) end function M.LuaUnit:runSuite( ... ) local args={...}; if args[1] ~= nil and type(args[1]) == 'table' and args[1].__class__ == 'LuaUnit' then -- run was called with the syntax M.LuaUnit:runSuite() -- we support both M.LuaUnit.run() and M.LuaUnit:run() -- strip out the first argument table.remove(args,1) end if #args == 0 then args = cmdline_argv end local no_error, error_msg, options, val no_error, val = pcall( M.LuaUnit.parseCmdLine, args ) if not no_error then error_msg = val print(error_msg) print() print(M.USAGE) os.exit(-1) end options = val if options.verbosity then self:setVerbosity( options.verbosity ) end if options.output and options.output:lower() == 'junit' and options.fname == nil then print('With junit output, a filename must be supplied with -n or --name') os.exit(-1) end if options.output then no_error, val = pcall(self.setOutputType,self,options.output) if not no_error then error_msg = val print(error_msg) print() print(M.USAGE) os.exit(-1) end end if options.fname then self:setFname( options.fname ) end if options.pattern then self.patternFilter = options.pattern end testNames = options['testNames'] if testNames == nil then testNames = M.LuaUnit.collectTests() end self:runSuiteByNames( testNames ) return self.result.failureCount end -- class LuaUnit return M luaunit-3.1/README.md0000666000000000000000000000757412477651646012506 0ustar 00000000000000## LuaUnit by Philippe Fremy [![Build status](https://ci.appveyor.com/api/projects/status/us6uh4e5q597jj54?svg=true&passingText=Windows%20Build%20passing&failingText=Windows%20Build%20failed)](https://ci.appveyor.com/project/bluebird75/luaunit) [![Build Status](https://travis-ci.org/bluebird75/luaunit.svg?branch=master)](https://travis-ci.org/bluebird75/luaunit) [![Documentation Status](https://readthedocs.org/projects/luaunit/badge/?version=latest)](https://readthedocs.org/projects/luaunit/?badge=latest) Luaunit is a unit-testing framework for Lua. It allows you to write test functions and test classes with test methods, combined with setup/teardown functionality. A wide range of assertions are supported. Luaunit supports several output format, like Junit or TAP, for easier integration into Continuous Integration platforms (Jenkins, Maven, ...) . The integrated command-line options provide a flexible interface to select tests by name or patterns, control output format, set verbosity, ... LuaUnit works with Lua 5.1 and 5.2 . It was tested on Windows XP, Windows Server 2012 R2 (x64) and Ubuntu 14.04 (see continuous build results on [Travis-CI](https://travis-ci.org/bluebird75/luaunit) and [AppVeyor](https://ci.appveyor.com/project/bluebird75/luaunit) ) and should work on all platforms supported by lua. It has no other dependency than lua itself. LuaUnit is packed into a single-file. To make start using it, just add the file to your project. LuaUnit is maintained on github: https://github.com/bluebird75/luaunit It is released under the BSD license. Documentation is available on [read-the-docs](http://luaunit.readthedocs.org/en/latest/) **Community** LuaUnit has a mailing list with low activity (a few emails per months). To subscribe or read the archives, please go to: [LuaUnit Mailing-list](http://lists.freehackers.org/list/luaunit%40freehackers.org/). If you are using LuaUnit, please drop us a note, we are always happy to hear from new users. ### History #### Version 3.0 - 9. Oct 2014 Since some people have forked LuaUnit and release some 2.x version, I am jumping the version number. - moved to Github - full documentation available in text, html and pdf at read-the-docs.org - new output format: JUnit - much better table assertions - new assertions for strings, with patterns and case insensitivity: assertStrContains, assertNotStrContains, assertNotStrIContains, assertStrIContains, assertStrMatches - new assertions for floats: assertAlmostEquals, assertNotAlmostEquals - type assertions: assertIsString, assertIsNumber, ... - error assertions: assertErrorMsgEquals, assertErrorMsgContains, assertErrorMsgMatches - improved error messages for several assertions - command-line options to select test, control output type and verbosity #### Version 1.5 - 8. Nov 2012 - compatibility with Lua 5.1 and 5.2 - better object model internally - a lot more of internal tests - several internal bug fixes - make it easy to customize the test output - running test functions no longer requires a wrapper - several level of verbosity #### Version 1.4 - 26. Jul 2012 - switch from X11 to more popular BSD license - add TAP output format for integration into Jenkins - official repository now on github #### Version 1.3 - 30. Oct 2007 - port to lua 5.1 - iterate over the test classes, methods and functions in the alphabetical order - change the default order of expected, actual in assertEquals (adjustable with USE_EXPECTED_ACTUAL_IN_ASSERT_EQUALS). #### Version 1.2 - 13. Jun 2005 - first public release #### Version 1.1 - move global variables to internal variables - assertion order is configurable between expected/actual or actual/expected - new assertion to check that a function call returns an error - display the calling stack when an error is spotted - two verbosity level, like in python unittest luaunit-3.1/run_functional_tests.lua0000666000000000000000000005511512477651646016174 0ustar 00000000000000require('os') lu = require('luaunit') function report( s ) print('>>>>>>> '..s ) end local IS_UNIX = ( package.config:sub(1,1) == '/' ) local LUA='"'..arg[-1]..'"' -- This function is extracted from the lua Nucleo project. -- License is MIT so ok to reuse here -- https://github.com/lua-nucleo/lua-nucleo/blob/v0.1.0/lua-nucleo/string.lua#L245-L267 local escape_lua_pattern do local matches = { ["^"] = "%^"; ["$"] = "%$"; ["("] = "%("; [")"] = "%)"; ["%"] = "%%"; ["."] = "%."; ["["] = "%["; ["]"] = "%]"; ["*"] = "%*"; ["+"] = "%+"; ["-"] = "%-"; ["?"] = "%?"; ["\0"] = "%z"; } escape_lua_pattern = function(s) return (s:gsub(".", matches)) end end function string_sub(s, orig, repl) -- replace occurence of string orig by string repl -- just like string.gsub, but with no pattern matching safeOrig = escape_lua_pattern(orig) return string.gsub( s, safeOrig, repl ) end function testStringSub() lu.assertEquals( string_sub('aa a % b cc', 'a % b', 'a + b'), 'aa a + b cc' ) lu.assertEquals( string_sub('aa: ?cc', ': ?', 'xx?'), 'aaxx?cc' ) end function osExec( s ) -- execute s with os.execute and return true if exit code is 0 -- false in any other conditions -- print('osExec('..s..')') local exitSuccess, exitReason, exitCode exitSuccess, exitReason, exitCode = os.execute( s ) -- print(exitSuccess) -- print(exitReason) -- print(exitCode) if _VERSION == 'Lua 5.1' then -- Lua 5.1 returns only the exit code exitReason = 'exit' if IS_UNIX then -- in C: exitCode = (exitSuccess >> 8) & 0xFF -- poor approximation that works: exitCode = (exitSuccess / 256) else -- Windows, life is simple exitCode = exitSuccess end end if exitReason ~= 'exit' or exitCode ~= 0 then -- print('return false '..tostring(exitCode)) return false, exitCode end -- print('return true') return true, exitCode end local HAS_XMLLINT do xmllint_output_fname = 'test/has_xmllint.txt' HAS_XMLLINT = osExec('xmllint --version 2> '..xmllint_output_fname) if not HAS_XMLLINT then report('WARNING: xmllint absent, can not validate xml validity') end os.remove(xmllint_output_fname) end function adjustFile( fileOut, fileIn, pattern, mayBeAbsent, verbose ) --[[ Adjust the content of fileOut by copying lines matching pattern from fileIn fileIn lines are read and the first line matching pattern is analysed. The first pattern capture is memorized. fileOut lines are then read, and the first line matching pattern is modified, by applying the first capture of fileIn. fileOut is then rewritten. ]] local source = nil mayBeAbsent = mayBeAbsent or false for line in io.lines(fileIn) do local idxStart, idxEnd, capture = string.find( line, pattern ) if idxStart ~= nil then if capture == nil then error(string.format('Must specify a capture for pattern %s in function adjustFile()', pattern ) ) end source = capture break end end if source == nil then if mayBeAbsent == true then -- no capture, just return return end error('No line in file '..fileIn..' matching pattern "'..pattern..'"') end if verbose then print('Captured in source: '.. source ) end local dest = nil local linesOut = {} for line in io.lines(fileOut) do local idxStart, idxEnd, capture = string.find( line, pattern ) if idxStart ~= nil then dest = capture if verbose then print('Modifying line: '..line ) end line = string_sub(line, dest, source) -- line = line:sub(1,idxStart-1)..source..line:sub(idxEnd+1) -- string.gsub( line, dest, source ) if verbose then print('Result: '..line ) end end table.insert( linesOut, line ) end if dest == nil then if mayBeAbsent == true then -- capture but nothing to adjust, just return return end error('No line in file '..fileOut..' matching pattern "'..pattern..'"' ) end f = io.open( fileOut, 'w') for i,l in ipairs(linesOut) do f:write( l..'\n' ) end f:close() end function check_tap_output( fileToRun, options, output, refOutput, refExitCode ) local ret -- remove output ret, exitCode = osExec(string.format( '%s %s --output TAP %s > %s', LUA, fileToRun, options, output ) ) if refExitCode ~= nil and exitCode ~= refExitCode then error(string.format('Expected exit code %d but got %d for file %s', refExitCode, exitCode, fileToRun ) ) end adjustFile( output, refOutput, '# Started on (.*)') adjustFile( output, refOutput, '# Ran %d+ tests in (%d+.%d*).*') if options == '--verbose' then -- For Lua 5.1 / 5.2 compatibility adjustFile( output, refOutput, '(%s+%[C%]: i?n? ?%?)', true ) end ret = osExec( string.format([[diff -NPw -u -I " *\.[/\\]luaunit.lua:[0123456789]\+:.*" %s %s]], refOutput, output ) ) if not ret then error('TAP Output mismatch for file : '..output) end -- report('TAP Output ok: '..output) return 0 end function check_text_output( fileToRun, options, output, refOutput, refExitCode ) local ret -- remove output ret, exitCode = osExec(string.format( '%s %s --output text %s > %s', LUA, fileToRun, options, output ) ) if refExitCode ~= nil and exitCode ~= refExitCode then error(string.format('Expected exit code %d but got %d for file %s', refExitCode, exitCode, fileToRun ) ) end if options == '--verbose' then adjustFile( output, refOutput, 'Started on (.*)') end adjustFile( output, refOutput, 'Ran .* tests in (%d.%d*) seconds' ) if options ~= '--quiet' then -- For Lua 5.1 / 5.2 compatibility adjustFile( output, refOutput, '(%s+%[C%]: i?n? ?%?)', true ) end ret = osExec( string.format([[diff -NPw -u -I " *\.[/\\]luaunit.lua:[0123456789]\+:.*" %s %s]], refOutput, output ) ) if not ret then error('Text Output mismatch for file : '..output) return 1 end -- report('Text Output ok: '..output) return 0 end function check_nil_output( fileToRun, options, output, refOutput, refExitCode ) local ret -- remove output ret, exitCode = osExec(string.format( '%s %s --output nil %s > %s', LUA, fileToRun, options, output ) ) if refExitCode ~= nil and exitCode ~= refExitCode then error(string.format('Expected exit code %d but got %d for file %s', refExitCode, exitCode, fileToRun ) ) end ret = osExec( string.format([[diff -NPw -u -I " *\.[/\\]luaunit.lua:[0123456789]\+:.*" %s %s]], refOutput, output ) ) if not ret then error('NIL Output mismatch for file : '..output) end -- report('NIL Output ok: '..output) return 0 end function check_xml_output( fileToRun, options, output, xmlOutput, xmlLintOutput, refOutput, refXmlOutput, refExitCode ) local ret, retcode retcode = 0 -- remove output ret, exitCode = osExec(string.format( '%s %s %s --output junit --name %s > %s', LUA, fileToRun, options, xmlOutput, output ) ) if refExitCode ~= nil and exitCode ~= refExitCode then error(string.format('Expected exit code %d but got %d for file %s', refExitCode, exitCode, fileToRun ) ) end adjustFile( output, refOutput, '# XML output to (.*)') adjustFile( output, refOutput, '# Started on (.*)') adjustFile( output, refOutput, '# Ran %d+ tests in (%d+.%d*).*') adjustFile( xmlOutput, refXmlOutput, '.*') adjustFile( output, refOutput, '(.+%[C%]: i?n? ?%?)', true ) adjustFile( xmlOutput, refXmlOutput, '(.+%[C%]: i?n? ?%?.*)', true ) if HAS_XMLLINT then -- General xmllint validation ret = osExec( string.format('xmllint --noout %s > %s', xmlOutput, xmlLintOutput ) ) if ret then -- report(string.format('XMLLint validation ok: file %s', xmlLintOutput) ) else error(string.format('XMLLint reported errors : file %s', xmlLintOutput) ) retcode = retcode + 1 end -- Validation against apache junit schema ret = osExec( string.format('xmllint --noout --schema junitxml/junit-apache-ant.xsd %s 2> %s', xmlOutput, xmlLintOutput ) ) if ret then -- report(string.format('XMLLint validation ok: file %s', xmlLintOutput) ) else error(string.format('XMLLint reported errors against apache schema: file %s', xmlLintOutput) ) retcode = retcode + 1 end -- Validation against jenkins/hudson schema ret = osExec( string.format('xmllint --noout --schema junitxml/junit-jenkins.xsd %s 2> %s', xmlOutput, xmlLintOutput ) ) if ret then -- report(string.format('XMLLint validation ok: file %s', xmlLintOutput) ) else error(string.format('XMLLint reported errors against apache schema: file %s', xmlLintOutput) ) retcode = retcode + 1 end end -- ignore change in line numbers for luaunit ret = osExec( string.format([[diff -NPw -u -I " *\.[/\\]luaunit.lua:[0123456789]\+:.*" %s %s]], refXmlOutput, xmlOutput ) ) if not ret then error('XML content mismatch for file : '..xmlOutput) retcode = retcode + 1 end ret = osExec( string.format([[diff -NPw -u -I " *\.[/\\]luaunit.lua:[0123456789]\+:.*" %s %s]], refOutput, output ) ) if not ret then error('XML Output mismatch for file : '..output) retcode = retcode + 1 end if retcode == 0 then -- report('XML Output ok: '..output) end return retcode end -- check tap output function testTapDefault() lu.assertEquals( 0, check_tap_output('example_with_luaunit.lua', '', 'test/exampleTapDefault.txt', 'test/ref/exampleTapDefault.txt', 12) ) lu.assertEquals( 0, check_tap_output('run_unit_tests.lua', '', 'test/unitTestsTapDefault.txt', 'test/ref/unitTestsTapDefault.txt', 0 ) ) end function testTapVerbose() lu.assertEquals( 0, check_tap_output('example_with_luaunit.lua', '--verbose', 'test/exampleTapVerbose.txt', 'test/ref/exampleTapVerbose.txt', 12 ) ) lu.assertEquals( 0, check_tap_output('run_unit_tests.lua', '--verbose', 'test/unitTestsVerbose.txt', 'test/ref/unitTestsTapVerbose.txt', 0 ) ) end function testTapQuiet() lu.assertEquals( 0, check_tap_output('example_with_luaunit.lua', '--quiet', 'test/exampleTapQuiet.txt', 'test/ref/exampleTapQuiet.txt', 12 ) ) lu.assertEquals( 0, check_tap_output('run_unit_tests.lua', '--quiet', 'test/unitTestsTapQuiet.txt', 'test/ref/unitTestsTapQuiet.txt', 0 ) ) end -- check text output function testTextDefault() lu.assertEquals( 0, check_text_output('example_with_luaunit.lua', '', 'test/exampleTextDefault.txt', 'test/ref/exampleTextDefault.txt', 12 ) ) lu.assertEquals( 0, check_text_output('run_unit_tests.lua', '', 'test/unitTestsTextDefault.txt', 'test/ref/unitTestsTextDefault.txt', 0 ) ) end function testTextVerbose() lu.assertEquals( 0, check_text_output('example_with_luaunit.lua', '--verbose', 'test/exampleTextVerbose.txt', 'test/ref/exampleTextVerbose.txt', 12 ) ) lu.assertEquals( 0, check_text_output('run_unit_tests.lua', '--verbose', 'test/unitTestsTextVerbose.txt', 'test/ref/unitTestsTextVerbose.txt', 0 ) ) end function testTextQuiet() lu.assertEquals( 0, check_text_output('example_with_luaunit.lua', '--quiet', 'test/exampleTextQuiet.txt', 'test/ref/exampleTextQuiet.txt', 12 ) ) lu.assertEquals( 0, check_text_output('run_unit_tests.lua', '--quiet', 'test/unitTestsTextQuiet.txt', 'test/ref/unitTestsTextQuiet.txt', 0 ) ) end -- check nil output function testNilDefault() lu.assertEquals( 0, check_nil_output('example_with_luaunit.lua', '', 'test/exampleNilDefault.txt', 'test/ref/exampleNilDefault.txt', 12 ) ) lu.assertEquals( 0, check_nil_output('run_unit_tests.lua', '', 'test/unitTestseNilDefault.txt', 'test/ref/unitTestsNilDefault.txt', 0 ) ) end -- check xml output function testXmlDefault() lu.assertEquals( 0, check_xml_output('example_with_luaunit.lua', '', 'test/exampleXmlDefault.txt', 'test/exampleXmlDefault.xml', 'test/exampleXmllintDefault.xml', 'test/ref/exampleXmlDefault.txt', 'test/ref/exampleXmlDefault.xml', 12 ) ) lu.assertEquals( 0, check_xml_output('run_unit_tests.lua', '', 'test/unitTestsXmlDefault.txt', 'test/unitTestsXmlDefault.xml', 'test/unitTestsXmllintDefault.xml', 'test/ref/unitTestsXmlDefault.txt', 'test/ref/unitTestsXmlDefault.xml', 0 ) ) end function testXmlVerbose() lu.assertEquals( 0, check_xml_output('example_with_luaunit.lua', '--verbose', 'test/exampleXmlVerbose.txt', 'test/exampleXmlVerbose.xml', 'test/exampleXmllintVerbose.xml', 'test/ref/exampleXmlVerbose.txt', 'test/ref/exampleXmlVerbose.xml', 12 ) ) lu.assertEquals( 0, check_xml_output('run_unit_tests.lua', '--verbose', 'test/unitTestsXmlVerbose.txt', 'test/unitTestsXmlVerbose.xml', 'test/unitTestsXmllintVerbose.xml', 'test/ref/unitTestsXmlVerbose.txt', 'test/ref/unitTestsXmlVerbose.xml', 0 ) ) end function testXmlQuiet() lu.assertEquals( 0, check_xml_output('example_with_luaunit.lua', '--quiet', 'test/exampleXmlQuiet.txt', 'test/exampleXmlQuiet.xml', 'test/exampleXmllintQuiet.xml', 'test/ref/exampleXmlQuiet.txt', 'test/ref/exampleXmlQuiet.xml', 12 ) ) lu.assertEquals( 0, check_xml_output('run_unit_tests.lua', '--quiet', 'test/unitTestsXmlQuiet.txt', 'test/unitTestsXmlQuiet.xml', 'test/unitTestsXmllintQuiet.xml', 'test/ref/unitTestsXmlQuiet.txt', 'test/ref/unitTestsXmlQuiet.xml', 0 ) ) end function testTestXmlDefault() if _VERSION == 'Lua 5.1' then -- this test differs slightly in Lua 5.1 and 5.2 -- I did not manage to adjust the "(...tail call...)" printed differently in Lua 5.2 vs 5.1 lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '', 'test/testWithXmlDefault51.txt', 'test/testWithXmlDefault51.xml', 'test/testWithXmlLintDefault51.txt', 'test/ref/testWithXmlDefault51.txt', 'test/ref/testWithXmlDefault51.xml', 2 ) ) else lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '', 'test/testWithXmlDefault.txt', 'test/testWithXmlDefault.xml', 'test/testWithXmlLintDefault.txt', 'test/ref/testWithXmlDefault.txt', 'test/ref/testWithXmlDefault.xml', 2 ) ) end end function testTestXmlVerbose() if _VERSION == 'Lua 5.1' then lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '--verbose', 'test/testWithXmlVerbose51.txt', 'test/testWithXmlVerbose51.xml', 'test/testWithXmlLintVerbose51.txt', 'test/ref/testWithXmlVerbose51.txt', 'test/ref/testWithXmlVerbose51.xml', 2 ) ) else lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '--verbose', 'test/testWithXmlVerbose.txt', 'test/testWithXmlVerbose.xml', 'test/testWithXmlLintVerbose.txt', 'test/ref/testWithXmlVerbose.txt', 'test/ref/testWithXmlVerbose.xml', 2 ) ) end end function testTestXmlQuiet() if _VERSION == 'Lua 5.1' then lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '--quiet', 'test/testWithXmlQuiet51.txt', 'test/testWithXmlQuiet51.xml', 'test/testWithXmlLintQuiet51.txt', 'test/ref/testWithXmlQuiet51.txt', 'test/ref/testWithXmlQuiet51.xml', 2 ) ) else lu.assertEquals( 0, check_xml_output('test/test_with_xml.lua', '--quiet', 'test/testWithXmlQuiet.txt', 'test/testWithXmlQuiet.xml', 'test/testWithXmlLintQuiet.txt', 'test/ref/testWithXmlQuiet.txt', 'test/ref/testWithXmlQuiet.xml', 2 ) ) end end function testLegacyLuaunitUsage() -- run test/legacy_example_usage and check exit status local ret, exitCode, refExitCode, fileToRun fileToRun = "test/legacy_example_with_luaunit.lua" fileOutput = "test/legacyExample.txt" refExitCode = 12 ret, exitCode = osExec(string.format( '%s %s --output text > %s', LUA, fileToRun, fileOutput) ) if refExitCode ~= nil and exitCode ~= refExitCode then error(string.format('Expected exit code %d but got %d for file %s', refExitCode, exitCode, fileToRun ) ) end end filesToGenerateExampleXml = { { 'example_with_luaunit.lua', '', '--output junit --name test/ref/exampleXmlDefault.xml', 'test/ref/exampleXmlDefault.txt' }, { 'example_with_luaunit.lua', '--quiet', '--output junit --name test/ref/exampleXmlQuiet.xml', 'test/ref/exampleXmlQuiet.txt' }, { 'example_with_luaunit.lua', '--verbose', '--output junit --name test/ref/exampleXmlVerbose.xml', 'test/ref/exampleXmlVerbose.txt' }, } filesToGenerateExampleTap = { { 'example_with_luaunit.lua', '', '--output tap', 'test/ref/exampleTapDefault.txt' }, { 'example_with_luaunit.lua', '--quiet', '--output tap', 'test/ref/exampleTapQuiet.txt' }, { 'example_with_luaunit.lua', '--verbose', '--output tap', 'test/ref/exampleTapVerbose.txt' }, } filesToGenerateExampleText = { { 'example_with_luaunit.lua', '', '--output text', 'test/ref/exampleTextDefault.txt' }, { 'example_with_luaunit.lua', '--quiet', '--output text', 'test/ref/exampleTextQuiet.txt' }, { 'example_with_luaunit.lua', '--verbose', '--output text', 'test/ref/exampleTextVerbose.txt' }, } filesToGenerateExampleNil = { { 'example_with_luaunit.lua', '', '--output nil', 'test/ref/exampleNilDefault.txt' }, } filesToGenerateUnitXml = { { 'run_unit_tests.lua', '', '--output junit --name test/ref/unitTestsXmlDefault.xml', 'test/ref/unitTestsXmlDefault.txt' }, { 'run_unit_tests.lua', '--quiet', '--output junit --name test/ref/unitTestsXmlQuiet.xml', 'test/ref/unitTestsXmlQuiet.txt' }, { 'run_unit_tests.lua', '--verbose', '--output junit --name test/ref/unitTestsXmlVerbose.xml', 'test/ref/unitTestsXmlVerbose.txt' }, } filesToGenerateUnitTap = { { 'run_unit_tests.lua', '', '--output tap', 'test/ref/unitTestsTapDefault.txt' }, { 'run_unit_tests.lua', '--quiet', '--output tap', 'test/ref/unitTestsTapQuiet.txt' }, { 'run_unit_tests.lua', '--verbose', '--output tap', 'test/ref/unitTestsTapVerbose.txt' }, } filesToGenerateUnitText = { { 'run_unit_tests.lua', '', '--output text', 'test/ref/unitTestsTextDefault.txt' }, { 'run_unit_tests.lua', '--quiet', '--output text', 'test/ref/unitTestsTextQuiet.txt' }, { 'run_unit_tests.lua', '--verbose', '--output text', 'test/ref/unitTestsTextVerbose.txt' }, } filesToGenerateTestXml = {} if _VERSION == 'Lua 5.1' then table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '', '--output junit --name test/ref/testWithXmlDefault51.xml', 'test/ref/testWithXmlDefault51.txt' } ) table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '--verbose', '--output junit --name test/ref/testWithXmlVerbose51.xml', 'test/ref/testWithXmlVerbose51.txt' } ) table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '--quiet', '--output junit --name test/ref/testWithXmlQuiet51.xml', 'test/ref/testWithXmlQuiet51.txt' } ) else table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '', '--output junit --name test/ref/testWithXmlDefault.xml', 'test/ref/testWithXmlDefault.txt' } ) table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '--verbose', '--output junit --name test/ref/testWithXmlVerbose.xml', 'test/ref/testWithXmlVerbose.txt' } ) table.insert( filesToGenerateTestXml, { 'test/test_with_xml.lua', '--quiet', '--output junit --name test/ref/testWithXmlQuiet.xml', 'test/ref/testWithXmlQuiet.txt' } ) end filesSetIndex = { UnitText=filesToGenerateUnitText, UnitTap=filesToGenerateUnitTap, UnitXml=filesToGenerateUnitXml, ExampleNil=filesToGenerateExampleNil, ExampleText=filesToGenerateExampleText, ExampleTap=filesToGenerateExampleTap, ExampleXml=filesToGenerateExampleXml, TestXml=filesToGenerateTestXml, } function updateRefFiles( filesToGenerate ) local ret for i,v in ipairs(filesToGenerate) do report('Generating '..v[4]) ret = osExec( string.format('%s %s %s %s > %s', LUA, v[1], v[2], v[3], v[4]) ) --[[ -- exitcode != 0 is not an error for us ... if ret == false then error('Error while generating '..prettystr(v) ) os.exit(1) end ]] end end function main() if arg[1] == '--update' then if #arg == 1 then -- generate all files -- print('Generating all files' ) for k,v in pairs(filesSetIndex) do -- print('Generating '..v ) updateRefFiles( v ) end else -- generate subset of files local i=2 while i <= #arg do fileSet = filesSetIndex[ arg[i] ] if fileSet == nil then local validTarget = '' for k,v in pairs(filesSetIndex) do validTarget = validTarget .. ' '.. k end error(string.format('Unable to generate files for target %s\nPossible targets: %s\n', arg[i], validTarget) ) end -- print('Generating '..arg[i]) updateRefFiles( fileSet ) i = i + 1 end end os.exit(0) end os.exit( lu.LuaUnit.run() ) -- body end main() -- TODO check output of run_unit_tests -- TODO check return values of execution luaunit-3.1/run_unit_tests.lua0000666000000000000000000000016212477651646015001 0ustar 00000000000000 require('test.test_luaunit') lu = require('luaunit') lu.LuaUnit.verbosity = 2 os.exit( lu.LuaUnit.run() ) luaunit-3.1/test/0000777000000000000000000000000012477651662012167 5ustar 00000000000000luaunit-3.1/test/exampleNilDefault.txt0000666000000000000000000000000012477651656016324 0ustar 00000000000000luaunit-3.1/test/exampleTapDefault.txt0000666000000000000000000000244712477651656016347 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 not ok 2 TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 not ok 5 TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" ok 6 TestToto.test3 not ok 7 TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 not ok 8 TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 not ok 9 TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false not ok 10 TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} not ok 11 TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! not ok 12 TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! not ok 13 test1_withFailure example_with_luaunit.lua:124: assertion failed! not ok 14 test2_withFailure example_with_luaunit.lua:130: assertion failed! ok 15 test3 # Ran 15 tests in 0.013 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleTapQuiet.txt0000666000000000000000000000110612477651656016041 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure not ok 2 TestTiti.test2_withFailure ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure not ok 5 TestToto.test2_withFailure ok 6 TestToto.test3 not ok 7 TestToto.test4 not ok 8 TestToto.test5 not ok 9 TestToto.test6 not ok 10 TestToto.test7 not ok 11 TestToto.test8a not ok 12 TestToto.test8b not ok 13 test1_withFailure not ok 14 test2_withFailure ok 15 test3 # Ran 15 tests in 0.012 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleTapVerbose.txt0000666000000000000000000000505712477651656016370 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' not ok 2 TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' not ok 5 TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' ok 6 TestToto.test3 not ok 7 TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' not ok 8 TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' not ok 9 TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' not ok 10 TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' not ok 11 TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' not ok 12 TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' not ok 13 test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' not ok 14 test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' ok 15 test3 # Ran 15 tests in 0.013 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleTextDefault.txt0000666000000000000000000000433412477651663016542 0ustar 00000000000000FF.FF.FFFFFFFF. Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.011 seconds FAILED (failures=12) luaunit-3.1/test/exampleTextQuiet.txt0000666000000000000000000000433412477651663016245 0ustar 00000000000000FF.FF.FFFFFFFF. Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.013 seconds FAILED (failures=12) luaunit-3.1/test/exampleTextVerbose.txt0000666000000000000000000000664512477651663016572 0ustar 00000000000000Started on 03/06/15 00:08:03 TestTiti.test1_withFailure ... FAIL example_with_luaunit.lua:99: expected: 2, actual: 1 TestTiti.test2_withFailure ... FAIL example_with_luaunit.lua:108: expected: "bof" actual: "hop" TestTiti.test3 ... Ok TestToto.test1_withFailure ... FAIL example_with_luaunit.lua:19: expected: 2, actual: 1 TestToto.test2_withFailure ... FAIL example_with_luaunit.lua:28: expected: "bof" actual: "hop" TestToto.test3 ... Ok TestToto.test4 ... FAIL example_with_luaunit.lua:41: Received the not expected value: 1 TestToto.test5 ... FAIL example_with_luaunit.lua:47: expected: false, actual: 1 TestToto.test6 ... FAIL example_with_luaunit.lua:52: expected: true, actual: false TestToto.test7 ... FAIL example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} TestToto.test8a ... FAIL example_with_luaunit.lua:76: Bouhouhoum error! TestToto.test8b ... FAIL example_with_luaunit.lua:76: Bouhouhoum error! test1_withFailure ... FAIL example_with_luaunit.lua:124: assertion failed! test2_withFailure ... FAIL example_with_luaunit.lua:130: assertion failed! test3 ... Ok ========================================================= Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.006 seconds FAILED (failures=12) luaunit-3.1/test/exampleXmlDefault.txt0000666000000000000000000000301212477651663016346 0ustar 00000000000000# XML output to test/ref/exampleXmlDefault.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.000 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleXmlDefault.xml0000666000000000000000000001107712477651663016341 0ustar 00000000000000 luaunit-3.1/test/exampleXmllintDefault.xml0000666000000000000000000000004512477651663017221 0ustar 00000000000000test/exampleXmlDefault.xml validates luaunit-3.1/test/exampleXmllintQuiet.xml0000666000000000000000000000004312477651664016723 0ustar 00000000000000test/exampleXmlQuiet.xml validates luaunit-3.1/test/exampleXmllintVerbose.xml0000666000000000000000000000004512477651664017243 0ustar 00000000000000test/exampleXmlVerbose.xml validates luaunit-3.1/test/exampleXmlQuiet.txt0000666000000000000000000000301012477651664016050 0ustar 00000000000000# XML output to test/ref/exampleXmlQuiet.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.010 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleXmlQuiet.xml0000666000000000000000000001107712477651664016045 0ustar 00000000000000 luaunit-3.1/test/exampleXmlVerbose.txt0000666000000000000000000000301212477651664016370 0ustar 00000000000000# XML output to test/ref/exampleXmlVerbose.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.000 seconds, 3 successes, 12 failures luaunit-3.1/test/exampleXmlVerbose.xml0000666000000000000000000001107712477651664016363 0ustar 00000000000000 luaunit-3.1/test/legacyExample.txt0000666000000000000000000000546412477651656015524 0ustar 00000000000000TestTiti:setUp some stuff test 1 TestTiti:tearDown FTestTiti:setUp some stuff test 2 TestTiti:tearDown FTestTiti:setUp some stuff test 3 TestTiti:tearDown .some stuff test 1 Fsome stuff test 2 Fsome stuff test 3 .some stuff test 4 Fsome stuff test 5 Fsome stuff test 6 FFFFFF. Failed tests: ------------- 1) TestTiti.test1_withFailure test/legacy_example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: test/legacy_example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure test/legacy_example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: test/legacy_example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure test/legacy_example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: test/legacy_example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure test/legacy_example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: test/legacy_example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 test/legacy_example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: test/legacy_example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 test/legacy_example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: test/legacy_example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 test/legacy_example_with_luaunit.lua:52: expected: true, actual: false stack traceback: test/legacy_example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 test/legacy_example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: test/legacy_example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a test/legacy_example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: test/legacy_example_with_luaunit.lua:76: in function 'funcWithError' test/legacy_example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b test/legacy_example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: test/legacy_example_with_luaunit.lua:76: in function 'funcWithError' test/legacy_example_with_luaunit.lua:72: in function 'funcWithFuncWithError' test/legacy_example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure test/legacy_example_with_luaunit.lua:124: assertion failed! stack traceback: test/legacy_example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure test/legacy_example_with_luaunit.lua:130: assertion failed! stack traceback: test/legacy_example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.010 seconds FAILED (failures=12) luaunit-3.1/test/legacy_example_with_luaunit.lua0000666000000000000000000000644312477651646020456 0ustar 00000000000000EXPORT_ASSERT_TO_GLOBALS = true require('luaunit') TestToto = {} --class function TestToto:setUp() -- set up tests self.a = 1 self.s = 'hop' self.t1 = {1,2,3} self.t2 = {one=1,two=2,three=3} self.t3 = {1,2,three=3} end function TestToto:test1_withFailure() print( "some stuff test 1" ) assertEquals( self.a , 1 ) -- will fail assertEquals( self.a , 2 ) assertEquals( self.a , 2 ) end function TestToto:test2_withFailure() print( "some stuff test 2" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) -- will fail assertEquals( self.s , 'bof' ) assertEquals( self.s , 'bof' ) end function TestToto:test3() print( "some stuff test 3" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) assertEquals( type(self.a), 'number' ) end function TestToto:test4() print( "some stuff test 4" ) assertNotEquals( self.a , 1 ) end function TestToto:test5() print( "some stuff test 5" ) assertTrue( self.a ) assertFalse( self.a ) end function TestToto:test6() print( "some stuff test 6" ) assertTrue( false ) end function TestToto:test7() -- assertEquals( {1,2}, self.t1 ) -- assertEquals( {1,2}, self.t2 ) assertEquals( {1,2}, self.t3 ) end function TestToto:test8a() -- failure occurs in a submethod self:funcWithError() end function TestToto:test8b() -- failure occurs in a submethod self:funcWithFuncWithError() end function TestToto:funcWithFuncWithError() self:funcWithError() end function TestToto:funcWithError() error('Bouhouhoum error!') end -- class TestToto TestTiti = {} --class function TestTiti:setUp() -- set up tests self.a = 1 self.s = 'hop' print( 'TestTiti:setUp' ) end function TestTiti:tearDown() -- some tearDown() code if necessary print( 'TestTiti:tearDown' ) end function TestTiti:test1_withFailure() print( "some stuff test 1" ) assertEquals( self.a , 1 ) -- will fail assertEquals( self.a , 2 ) assertEquals( self.a , 2 ) end function TestTiti:test2_withFailure() print( "some stuff test 2" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) -- will fail assertEquals( self.s , 'bof' ) assertEquals( self.s , 'bof' ) end function TestTiti:test3() print( "some stuff test 3" ) assertEquals( self.a , 1 ) assertEquals( self.s , 'hop' ) end -- class TestTiti -- simple test functions that were written previously can be integrated -- in luaunit too function test1_withFailure() assert( 1 == 1) -- will fail assert( 1 == 2) end function test2_withFailure() assert( 'a' == 'a') -- will fail assert( 'a' == 'b') end function test3() assert( 1 == 1) assert( 'a' == 'a') end lu = LuaUnit.new() lu:setOutputType("tap") os.exit( lu:runSuite() ) luaunit-3.1/test/ref/0000777000000000000000000000000012477651646012745 5ustar 00000000000000luaunit-3.1/test/ref/exampleNilDefault.txt0000666000000000000000000000000012477651646017077 0ustar 00000000000000luaunit-3.1/test/ref/exampleTapDefault.txt0000666000000000000000000000244712477651646017122 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 not ok 2 TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 not ok 5 TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" ok 6 TestToto.test3 not ok 7 TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 not ok 8 TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 not ok 9 TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false not ok 10 TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} not ok 11 TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! not ok 12 TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! not ok 13 test1_withFailure example_with_luaunit.lua:124: assertion failed! not ok 14 test2_withFailure example_with_luaunit.lua:130: assertion failed! ok 15 test3 # Ran 15 tests in 0.013 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleTapQuiet.txt0000666000000000000000000000110612477651646016614 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure not ok 2 TestTiti.test2_withFailure ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure not ok 5 TestToto.test2_withFailure ok 6 TestToto.test3 not ok 7 TestToto.test4 not ok 8 TestToto.test5 not ok 9 TestToto.test6 not ok 10 TestToto.test7 not ok 11 TestToto.test8a not ok 12 TestToto.test8b not ok 13 test1_withFailure not ok 14 test2_withFailure ok 15 test3 # Ran 15 tests in 0.012 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleTapVerbose.txt0000666000000000000000000000505712477651646017143 0ustar 000000000000001..15 # Started on 03/06/15 00:07:22 # Starting class: TestTiti not ok 1 TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' not ok 2 TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' ok 3 TestTiti.test3 # Starting class: TestToto not ok 4 TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' not ok 5 TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' ok 6 TestToto.test3 not ok 7 TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' not ok 8 TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' not ok 9 TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' not ok 10 TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' not ok 11 TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' not ok 12 TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' not ok 13 test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' not ok 14 test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' ok 15 test3 # Ran 15 tests in 0.013 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleTextDefault.txt0000666000000000000000000000433412477651646017317 0ustar 00000000000000FF.FF.FFFFFFFF. Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.011 seconds FAILED (failures=12) luaunit-3.1/test/ref/exampleTextQuiet.txt0000666000000000000000000000433412477651646017022 0ustar 00000000000000FF.FF.FFFFFFFF. Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.013 seconds FAILED (failures=12) luaunit-3.1/test/ref/exampleTextVerbose.txt0000666000000000000000000000664512477651646017347 0ustar 00000000000000Started on 03/06/15 00:08:03 TestTiti.test1_withFailure ... FAIL example_with_luaunit.lua:99: expected: 2, actual: 1 TestTiti.test2_withFailure ... FAIL example_with_luaunit.lua:108: expected: "bof" actual: "hop" TestTiti.test3 ... Ok TestToto.test1_withFailure ... FAIL example_with_luaunit.lua:19: expected: 2, actual: 1 TestToto.test2_withFailure ... FAIL example_with_luaunit.lua:28: expected: "bof" actual: "hop" TestToto.test3 ... Ok TestToto.test4 ... FAIL example_with_luaunit.lua:41: Received the not expected value: 1 TestToto.test5 ... FAIL example_with_luaunit.lua:47: expected: false, actual: 1 TestToto.test6 ... FAIL example_with_luaunit.lua:52: expected: true, actual: false TestToto.test7 ... FAIL example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} TestToto.test8a ... FAIL example_with_luaunit.lua:76: Bouhouhoum error! TestToto.test8b ... FAIL example_with_luaunit.lua:76: Bouhouhoum error! test1_withFailure ... FAIL example_with_luaunit.lua:124: assertion failed! test2_withFailure ... FAIL example_with_luaunit.lua:130: assertion failed! test3 ... Ok ========================================================= Failed tests: ------------- 1) TestTiti.test1_withFailure example_with_luaunit.lua:99: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:99: in function 'TestTiti.test1_withFailure' 2) TestTiti.test2_withFailure example_with_luaunit.lua:108: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:108: in function 'TestTiti.test2_withFailure' 3) TestToto.test1_withFailure example_with_luaunit.lua:19: expected: 2, actual: 1 stack traceback: example_with_luaunit.lua:19: in function 'TestToto.test1_withFailure' 4) TestToto.test2_withFailure example_with_luaunit.lua:28: expected: "bof" actual: "hop" stack traceback: example_with_luaunit.lua:28: in function 'TestToto.test2_withFailure' 5) TestToto.test4 example_with_luaunit.lua:41: Received the not expected value: 1 stack traceback: example_with_luaunit.lua:41: in function 'TestToto.test4' 6) TestToto.test5 example_with_luaunit.lua:47: expected: false, actual: 1 stack traceback: example_with_luaunit.lua:47: in function 'TestToto.test5' 7) TestToto.test6 example_with_luaunit.lua:52: expected: true, actual: false stack traceback: example_with_luaunit.lua:52: in function 'TestToto.test6' 8) TestToto.test7 example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7' 9) TestToto.test8a example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:63: in function 'TestToto.test8a' 10) TestToto.test8b example_with_luaunit.lua:76: Bouhouhoum error! stack traceback: example_with_luaunit.lua:76: in function 'funcWithError' example_with_luaunit.lua:72: in function 'funcWithFuncWithError' example_with_luaunit.lua:68: in function 'TestToto.test8b' 11) test1_withFailure example_with_luaunit.lua:124: assertion failed! stack traceback: example_with_luaunit.lua:124: in function 'test1_withFailure' 12) test2_withFailure example_with_luaunit.lua:130: assertion failed! stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure' Ran 15 tests in 0.006 seconds FAILED (failures=12) luaunit-3.1/test/ref/exampleXmlDefault.txt0000666000000000000000000000301212477651646017123 0ustar 00000000000000# XML output to test/ref/exampleXmlDefault.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.000 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleXmlDefault.xml0000666000000000000000000001107712477651663017115 0ustar 00000000000000 luaunit-3.1/test/ref/exampleXmlQuiet.txt0000666000000000000000000000301012477651646016624 0ustar 00000000000000# XML output to test/ref/exampleXmlQuiet.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.010 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleXmlQuiet.xml0000666000000000000000000001107712477651664016621 0ustar 00000000000000 luaunit-3.1/test/ref/exampleXmlVerbose.txt0000666000000000000000000000301212477651646017144 0ustar 00000000000000# XML output to test/ref/exampleXmlVerbose.xml # Started on 03/10/15 21:06:34 # Starting class: TestTiti # Starting test: TestTiti.test1_withFailure # Failure: example_with_luaunit.lua:99: expected: 2, actual: 1 # Starting test: TestTiti.test2_withFailure # Failure: example_with_luaunit.lua:108: expected: "bof" actual: "hop" # Starting test: TestTiti.test3 # Starting class: TestToto # Starting test: TestToto.test1_withFailure # Failure: example_with_luaunit.lua:19: expected: 2, actual: 1 # Starting test: TestToto.test2_withFailure # Failure: example_with_luaunit.lua:28: expected: "bof" actual: "hop" # Starting test: TestToto.test3 # Starting test: TestToto.test4 # Failure: example_with_luaunit.lua:41: Received the not expected value: 1 # Starting test: TestToto.test5 # Failure: example_with_luaunit.lua:47: expected: false, actual: 1 # Starting test: TestToto.test6 # Failure: example_with_luaunit.lua:52: expected: true, actual: false # Starting test: TestToto.test7 # Failure: example_with_luaunit.lua:58: expected: {1, 2, three=3} actual: {1, 2} # Starting test: TestToto.test8a # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: TestToto.test8b # Failure: example_with_luaunit.lua:76: Bouhouhoum error! # Starting test: test1_withFailure # Failure: example_with_luaunit.lua:124: assertion failed! # Starting test: test2_withFailure # Failure: example_with_luaunit.lua:130: assertion failed! # Starting test: test3 # Ran 15 tests in 0.000 seconds, 3 successes, 12 failures luaunit-3.1/test/ref/exampleXmlVerbose.xml0000666000000000000000000001107712477651664017137 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlDefault.txt0000666000000000000000000000102312477651646017303 0ustar 00000000000000# XML output to test/ref/testWithXmlDefault.xml # Started on 03/10/15 21:06:34 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.120 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlDefault.xml0000666000000000000000000000260212477651651017264 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlDefault51.txt0000666000000000000000000000102512477651646017453 0ustar 00000000000000# XML output to test/ref/testWithXmlDefault51.xml # Started on 03/10/15 21:12:52 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.102 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlDefault51.xml0000666000000000000000000000260212477651657017440 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlQuiet.txt0000666000000000000000000000102112477651646017004 0ustar 00000000000000# XML output to test/ref/testWithXmlQuiet.xml # Started on 03/10/15 21:06:36 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.108 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlQuiet.xml0000666000000000000000000000260212477651652016770 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlQuiet51.txt0000666000000000000000000000102312477651646017154 0ustar 00000000000000# XML output to test/ref/testWithXmlQuiet51.xml # Started on 03/10/15 21:12:54 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.108 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlQuiet51.xml0000666000000000000000000000260212477651661017136 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlVerbose.txt0000666000000000000000000000102312477651646017324 0ustar 00000000000000# XML output to test/ref/testWithXmlVerbose.xml # Started on 03/10/15 21:06:35 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.102 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlVerbose.xml0000666000000000000000000000260212477651654017310 0ustar 00000000000000 luaunit-3.1/test/ref/testWithXmlVerbose51.txt0000666000000000000000000000102512477651646017474 0ustar 00000000000000# XML output to test/ref/testWithXmlVerbose51.xml # Started on 03/10/15 21:12:53 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.113 seconds, 1 successes, 2 failures luaunit-3.1/test/ref/testWithXmlVerbose51.xml0000666000000000000000000000260212477651662017455 0ustar 00000000000000 luaunit-3.1/test/ref/unitTestsTapDefault.txt0000666000000000000000000001432612477651646017470 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.015 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsTapQuiet.txt0000666000000000000000000001432612477651646017173 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.016 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsTapVerbose.txt0000666000000000000000000001432612477651646017511 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.016 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsTextDefault.txt0000666000000000000000000000022412477651646017660 0ustar 00000000000000............................................................................................................. Ran 109 tests in 0.023 seconds OK luaunit-3.1/test/ref/unitTestsTextQuiet.txt0000666000000000000000000000022412477651646017363 0ustar 00000000000000............................................................................................................. Ran 109 tests in 0.030 seconds OK luaunit-3.1/test/ref/unitTestsTextVerbose.txt0000666000000000000000000001411312477651646017703 0ustar 00000000000000Started on 02/01/15 00:00:56 TestLuaUnitAssertions.test_assertAlmostEquals ... Ok TestLuaUnitAssertions.test_assertEquals ... Ok TestLuaUnitAssertions.test_assertFalse ... Ok TestLuaUnitAssertions.test_assertIs ... Ok TestLuaUnitAssertions.test_assertIsBoolean ... Ok TestLuaUnitAssertions.test_assertIsCoroutine ... Ok TestLuaUnitAssertions.test_assertIsFunction ... Ok TestLuaUnitAssertions.test_assertIsNil ... Ok TestLuaUnitAssertions.test_assertIsNumber ... Ok TestLuaUnitAssertions.test_assertIsString ... Ok TestLuaUnitAssertions.test_assertIsTable ... Ok TestLuaUnitAssertions.test_assertIsUserdata ... Ok TestLuaUnitAssertions.test_assertItemsEquals ... Ok TestLuaUnitAssertions.test_assertNil ... Ok TestLuaUnitAssertions.test_assertNotAlmostEquals ... Ok TestLuaUnitAssertions.test_assertNotEquals ... Ok TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ... Ok TestLuaUnitAssertions.test_assertNotIs ... Ok TestLuaUnitAssertions.test_assertNotNil ... Ok TestLuaUnitAssertions.test_assertNotStrContains ... Ok TestLuaUnitAssertions.test_assertNotStrIContains ... Ok TestLuaUnitAssertions.test_assertStrContains ... Ok TestLuaUnitAssertions.test_assertStrIContains ... Ok TestLuaUnitAssertions.test_assertStrMatches ... Ok TestLuaUnitAssertions.test_assertTableAdditions ... Ok TestLuaUnitAssertions.test_assertTableLev2 ... Ok TestLuaUnitAssertions.test_assertTableList ... Ok TestLuaUnitAssertions.test_assertTableNil ... Ok TestLuaUnitAssertions.test_assertTableNilFront ... Ok TestLuaUnitAssertions.test_assertTableNum ... Ok TestLuaUnitAssertions.test_assertTableStr ... Ok TestLuaUnitAssertions.test_assertTrue ... Ok TestLuaUnitAssertionsError.test_assertError ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgContains ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgEquals ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgMatches ... Ok TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertError ... Ok TestLuaUnitErrorMsg.test_assertErrorMsg ... Ok TestLuaUnitErrorMsg.test_assertIs ... Ok TestLuaUnitErrorMsg.test_assertIsBoolean ... Ok TestLuaUnitErrorMsg.test_assertIsCoroutine ... Ok TestLuaUnitErrorMsg.test_assertIsFunction ... Ok TestLuaUnitErrorMsg.test_assertIsNumber ... Ok TestLuaUnitErrorMsg.test_assertIsString ... Ok TestLuaUnitErrorMsg.test_assertIsTable ... Ok TestLuaUnitErrorMsg.test_assertIsUserdata ... Ok TestLuaUnitErrorMsg.test_assertItemsEquals ... Ok TestLuaUnitErrorMsg.test_assertNil ... Ok TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertNotEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertNotIs ... Ok TestLuaUnitErrorMsg.test_assertNotStrContains ... Ok TestLuaUnitErrorMsg.test_assertNotStrIContains ... Ok TestLuaUnitErrorMsg.test_assertStrContains ... Ok TestLuaUnitErrorMsg.test_assertStrIContains ... Ok TestLuaUnitErrorMsg.test_assertStrMatches ... Ok TestLuaUnitErrorMsg.test_assertTrueFalse ... Ok TestLuaUnitErrorMsg.test_printTableWithRef ... Ok TestLuaUnitExecution.testOutputInterface ... Ok TestLuaUnitExecution.testRunReturnsNumberOfFailures ... Ok TestLuaUnitExecution.testRunSetupAndTeardown ... Ok TestLuaUnitExecution.testRunSomeTestByGlobalInstance ... Ok TestLuaUnitExecution.testRunSomeTestByLocalInstance ... Ok TestLuaUnitExecution.testTestCountAndFailCount ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors1 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors2 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors3 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors4 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors5 ... Ok TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ... Ok TestLuaUnitExecution.test_collectTests ... Ok TestLuaUnitExecution.test_filterWithPattern ... Ok TestLuaUnitExecution.test_runSuiteByNames ... Ok TestLuaUnitResults.test_nodeStatus ... Ok TestLuaUnitResults.test_resultsWhileTestInProgress ... Ok TestLuaUnitResults.test_runSuiteOk ... Ok TestLuaUnitResults.test_runSuiteWithFailures ... Ok TestLuaUnitUtilities.test_IsClassMethod ... Ok TestLuaUnitUtilities.test_IsFunction ... Ok TestLuaUnitUtilities.test_applyPatternFilter ... Ok TestLuaUnitUtilities.test_expandClasses ... Ok TestLuaUnitUtilities.test_expandOneClass ... Ok TestLuaUnitUtilities.test_genSortedIndex ... Ok TestLuaUnitUtilities.test_hasNewline ... Ok TestLuaUnitUtilities.test_includePattern ... Ok TestLuaUnitUtilities.test_isTestName ... Ok TestLuaUnitUtilities.test_parseCmdLine ... Ok TestLuaUnitUtilities.test_prefixString ... Ok TestLuaUnitUtilities.test_prettstrTableRecursion ... Ok TestLuaUnitUtilities.test_prettystr ... Ok TestLuaUnitUtilities.test_prettystr_adv_tables ... Ok TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ... Ok TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ... Ok TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ... Ok TestLuaUnitUtilities.test_splitClassMethod ... Ok TestLuaUnitUtilities.test_strMatch ... Ok TestLuaUnitUtilities.test_strSplit3CharDelim ... Ok TestLuaUnitUtilities.test_strSplitOnFailure ... Ok TestLuaUnitUtilities.test_strSplitOneCharDelim ... Ok TestLuaUnitUtilities.test_stripStackTrace ... Ok TestLuaUnitUtilities.test_table_keytostring ... Ok TestLuaUnitUtilities.test_xmlCDataEscape ... Ok TestLuaUnitUtilities.test_xmlEscape ... Ok TestMock.testMock ... Ok ========================================================= Ran 109 tests in 0.031 seconds OK luaunit-3.1/test/ref/unitTestsXmlDefault.txt0000666000000000000000000001577212477651646017512 0ustar 00000000000000# XML output to test/ref/unitTestsXmlDefault.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.042 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsXmlDefault.xml0000666000000000000000000003617712477651663017474 0ustar 00000000000000 luaunit-3.1/test/ref/unitTestsXmlQuiet.txt0000666000000000000000000001577012477651646017213 0ustar 00000000000000# XML output to test/ref/unitTestsXmlQuiet.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.031 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsXmlQuiet.xml0000666000000000000000000003617712477651664017200 0ustar 00000000000000 luaunit-3.1/test/ref/unitTestsXmlVerbose.txt0000666000000000000000000001577212477651646017533 0ustar 00000000000000# XML output to test/ref/unitTestsXmlVerbose.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.030 seconds, 109 successes, 0 failures luaunit-3.1/test/ref/unitTestsXmlVerbose.xml0000666000000000000000000003617712477651664017516 0ustar 00000000000000 luaunit-3.1/test/testWithXmlDefault.txt0000666000000000000000000000102312477651651016523 0ustar 00000000000000# XML output to test/ref/testWithXmlDefault.xml # Started on 03/10/15 21:06:34 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.120 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlDefault.xml0000666000000000000000000000260212477651651016510 0ustar 00000000000000 luaunit-3.1/test/testWithXmlDefault51.txt0000666000000000000000000000102512477651657016701 0ustar 00000000000000# XML output to test/ref/testWithXmlDefault51.xml # Started on 03/10/15 21:12:52 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.102 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlDefault51.xml0000666000000000000000000000260212477651657016664 0ustar 00000000000000 luaunit-3.1/test/testWithXmlLintDefault.txt0000666000000000000000000000004612477651651017356 0ustar 00000000000000test/testWithXmlDefault.xml validates luaunit-3.1/test/testWithXmlLintDefault51.txt0000666000000000000000000000005012477651660017517 0ustar 00000000000000test/testWithXmlDefault51.xml validates luaunit-3.1/test/testWithXmlLintQuiet.txt0000666000000000000000000000004412477651652017060 0ustar 00000000000000test/testWithXmlQuiet.xml validates luaunit-3.1/test/testWithXmlLintQuiet51.txt0000666000000000000000000000004612477651661017230 0ustar 00000000000000test/testWithXmlQuiet51.xml validates luaunit-3.1/test/testWithXmlLintVerbose.txt0000666000000000000000000000004612477651654017402 0ustar 00000000000000test/testWithXmlVerbose.xml validates luaunit-3.1/test/testWithXmlLintVerbose51.txt0000666000000000000000000000005012477651663017543 0ustar 00000000000000test/testWithXmlVerbose51.xml validates luaunit-3.1/test/testWithXmlQuiet.txt0000666000000000000000000000102112477651652016225 0ustar 00000000000000# XML output to test/ref/testWithXmlQuiet.xml # Started on 03/10/15 21:06:36 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.108 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlQuiet.xml0000666000000000000000000000260212477651652016214 0ustar 00000000000000 luaunit-3.1/test/testWithXmlQuiet51.txt0000666000000000000000000000102312477651661016375 0ustar 00000000000000# XML output to test/ref/testWithXmlQuiet51.xml # Started on 03/10/15 21:12:54 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.108 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlQuiet51.xml0000666000000000000000000000260212477651661016362 0ustar 00000000000000 luaunit-3.1/test/testWithXmlVerbose.txt0000666000000000000000000000102312477651654016547 0ustar 00000000000000# XML output to test/ref/testWithXmlVerbose.xml # Started on 03/10/15 21:06:35 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.102 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlVerbose.xml0000666000000000000000000000260212477651654016534 0ustar 00000000000000 luaunit-3.1/test/testWithXmlVerbose51.txt0000666000000000000000000000102512477651662016716 0ustar 00000000000000# XML output to test/ref/testWithXmlVerbose51.xml # Started on 03/10/15 21:12:53 # Starting class: TestFailuresWithXml # Starting test: TestFailuresWithXml.test_failure_with_cdata_xml # Failure: test/test_with_xml.lua:13: expected: "got it" actual: "cdata does not like ]]>" # Starting test: TestFailuresWithXml.test_failure_with_simple_xml # Failure: test/test_with_xml.lua:9: expected: "got it" actual: 'ti"ti' # Starting test: TestThatLastsALongTime # Ran 3 tests in 1.113 seconds, 1 successes, 2 failures luaunit-3.1/test/testWithXmlVerbose51.xml0000666000000000000000000000260212477651662016701 0ustar 00000000000000 luaunit-3.1/test/test_luaunit.lua0000666000000000000000000024353012477651646015423 0ustar 00000000000000--[[ Author: Philippe Fremy License: BSD License, see LICENSE.txt ]]-- -- This is a bit tricky since the test uses the features that it tests. lu = require('luaunit') Mock = { __class__ = 'Mock', calls = {} } function Mock:new() local t = {} t.__class__ = 'Mock' t.calls = {} function t.callRecorder( callInfo ) -- Return a function that stores its arguments in callInfo function f( ... ) -- Not lua 5.0 compliant: args ={...} for i,v in pairs(args) do table.insert( callInfo, v ) end end return f end local t_MT = {} function t_MT.__index( t, key ) local callInfo = { key } table.insert( t.calls, callInfo ) return t.callRecorder( callInfo ) end setmetatable( t, t_MT ) return t end TestMock = {} function TestMock:testMock() m = Mock:new() m.titi( 42 ) m.toto( 33, "abc", { 21} ) lu.assertEquals( m.calls[1][1], 'titi' ) lu.assertEquals( m.calls[1][2], 42 ) lu.assertEquals( #m.calls[1], 2 ) lu.assertEquals( m.calls[2][1], 'toto' ) lu.assertEquals( m.calls[2][2], 33 ) lu.assertEquals( m.calls[2][3], 'abc' ) lu.assertEquals( m.calls[2][4][1], 21 ) lu.assertEquals( #m.calls[2], 4 ) lu.assertEquals( #m.calls, 2 ) end ------------------------------------------------------------------ -- -- Utility Tests -- ------------------------------------------------------------------ TestLuaUnitUtilities = {} --class TestLuaUnitUtilities.__class__ = 'TestLuaUnitUtilities' function TestLuaUnitUtilities:test_genSortedIndex() lu.assertEquals( lu.private.__genSortedIndex( { 2, 5, 7} ), {1,2,3} ) lu.assertEquals( lu.private.__genSortedIndex( { a='1', h='2', c='3' } ), {'a', 'c', 'h'} ) lu.assertEquals( lu.private.__genSortedIndex( { 1, 'z', a='1', h='2', c='3' } ), { 1, 2, 'a', 'c', 'h' } ) end function TestLuaUnitUtilities:test_sortedNextReturnsSortedKeyValues() t1 = {} t1['aaa'] = 'abc' t1['ccc'] = 'def' t1['bbb'] = 'cba' k, v = lu.private.sortedNext( t1, nil ) lu.assertEquals( k, 'aaa' ) lu.assertEquals( v, 'abc' ) k, v = lu.private.sortedNext( t1, k ) lu.assertEquals( k, 'bbb' ) lu.assertEquals( v, 'cba' ) k, v = lu.private.sortedNext( t1, k ) lu.assertEquals( k, 'ccc' ) lu.assertEquals( v, 'def' ) k, v = lu.private.sortedNext( t1, k ) lu.assertEquals( k, nil ) lu.assertEquals( v, nil ) end function TestLuaUnitUtilities:test_sortedNextWorksTwiceOnTable() t1 = {} t1['aaa'] = 'abc' t1['ccc'] = 'def' t1['bbb'] = 'cba' k, v = lu.private.sortedNext( t1, nil ) k, v = lu.private.sortedNext( t1, k ) k, v = lu.private.sortedNext( t1, nil ) lu.assertEquals( k, 'aaa' ) lu.assertEquals( v, 'abc' ) end function TestLuaUnitUtilities:test_sortedNextWorksOnTwoTables() t1 = { aaa = 'abc', ccc = 'def' } t2 = { ['3'] = '33', ['1'] = '11' } k, v = lu.private.sortedNext( t1, nil ) lu.assertEquals( k, 'aaa' ) lu.assertEquals( v, 'abc' ) k, v = lu.private.sortedNext( t2, nil ) lu.assertEquals( k, '1' ) lu.assertEquals( v, '11' ) k, v = lu.private.sortedNext( t1, 'aaa' ) lu.assertEquals( k, 'ccc' ) lu.assertEquals( v, 'def' ) k, v = lu.private.sortedNext( t2, '1' ) lu.assertEquals( k, '3' ) lu.assertEquals( v, '33' ) end function TestLuaUnitUtilities:test_strSplitOneCharDelim() t = lu.private.strsplit( '\n', '1\n22\n333\n' ) lu.assertEquals( t[1], '1') lu.assertEquals( t[2], '22') lu.assertEquals( t[3], '333') lu.assertEquals( t[4], '') lu.assertEquals( #t, 4 ) end function TestLuaUnitUtilities:test_strSplit3CharDelim() t = lu.private.strsplit( '2\n3', '1\n22\n332\n3' ) lu.assertEquals( t[1], '1\n2') lu.assertEquals( t[2], '3') lu.assertEquals( t[3], '') lu.assertEquals( #t, 3 ) end function TestLuaUnitUtilities:test_strSplitOnFailure() s1 = 'd:/work/luaunit/luaunit-git/luaunit/test_luaunit.lua:467: expected: 1, actual: 2\n' s2 = [[stack traceback: .\luaunit.lua:443: in function <.\luaunit.lua:442> [C]: in function 'error' .\luaunit.lua:56: in function 'lu.assertEquals' d:/work/luaunit/luaunit-git/luaunit/test_luaunit.lua:467: in function [C]: in function 'xpcall' .\luaunit.lua:447: in function 'protectedCall' .\luaunit.lua:479: in function '_runTestMethod' .\luaunit.lua:527: in function 'runTestMethod' .\luaunit.lua:569: in function 'runTestClass' .\luaunit.lua:609: in function <.\luaunit.lua:588> (...tail calls...) d:/work/luaunit/luaunit-git/luaunit/test_luaunit.lua:528: in main chunk [C]: in ? ]] local SPLITTER = '\n>----------<\n' local t = lu.private.strsplit( SPLITTER, s1..SPLITTER..s2) lu.assertEquals( t[1], s1) lu.assertEquals( t[2], s2) lu.assertEquals( #t, 2 ) end function TestLuaUnitUtilities:test_prefixString() lu.assertEquals( lu.private.prefixString( '12 ', 'ab\ncd\nde'), '12 ab\n12 cd\n12 de' ) end function TestLuaUnitUtilities:test_table_keytostring() lu.assertEquals( table.keytostring( 'a' ), 'a' ) lu.assertEquals( table.keytostring( 'a0' ), 'a0' ) lu.assertEquals( table.keytostring( 'a0!' ), '"a0!"' ) end function TestLuaUnitUtilities:test_prettystr() lu.assertEquals( lu.prettystr( 1 ), "1" ) lu.assertEquals( lu.prettystr( 1.1 ), "1.1" ) lu.assertEquals( lu.prettystr( 'abc' ), '"abc"' ) lu.assertEquals( lu.prettystr( 'ab\ncd' ), '"ab\ncd"' ) lu.assertEquals( lu.prettystr( 'ab\ncd', true ), '"ab\\ncd"' ) lu.assertEquals( lu.prettystr( 'ab"cd' ), "'ab\"cd'" ) lu.assertEquals( lu.prettystr( "ab'cd" ), '"ab\'cd"' ) lu.assertStrContains( lu.prettystr( {1,2,3} ), "{1, 2, 3}" ) lu.assertStrContains( lu.prettystr( {a=1,bb=2,ab=3} ), '{a=1, ab=3, bb=2}' ) end function TestLuaUnitUtilities:test_prettystr_adv_tables() local t1 = {1,2,3,4,5,6} lu.assertEquals(lu.prettystr(t1), "{1, 2, 3, 4, 5, 6}" ) local t2 = {'aaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbb', 'ccccccccccccccccc', 'ddddddddddddd', 'eeeeeeeeeeeeeeeeee', 'ffffffffffffffff', 'ggggggggggg', 'hhhhhhhhhhhhhh'} lu.assertEquals(lu.prettystr(t2), table.concat( { '{', ' "aaaaaaaaaaaaaaaaa",', ' "bbbbbbbbbbbbbbbbbbbb",', ' "ccccccccccccccccc",', ' "ddddddddddddd",', ' "eeeeeeeeeeeeeeeeee",', ' "ffffffffffffffff",', ' "ggggggggggg",', ' "hhhhhhhhhhhhhh"', '}', } , '\n' ) ) local t2bis = { 1,2,3,'12345678901234567890123456789012345678901234567890123456789012345678901234567890', 4,5,6 } lu.assertEquals(lu.prettystr(t2bis), [[{ 1, 2, 3, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 5, 6 }]] ) local t3 = { l1a = { l2a = { l3a='012345678901234567890123456789012345678901234567890123456789' }, l2b='bbb' }, l1b = 4} lu.assertEquals(lu.prettystr(t3), [[{ l1a={ l2a={l3a="012345678901234567890123456789012345678901234567890123456789"}, l2b="bbb" }, l1b=4 }]] ) local t4 = { a=1, b=2, c=3 } lu.assertEquals(lu.prettystr(t4), '{a=1, b=2, c=3}' ) local t5 = { t1, t2, t3 } lu.assertEquals( lu.prettystr(t5), [[{ {1, 2, 3, 4, 5, 6}, { "aaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbb", "ccccccccccccccccc", "ddddddddddddd", "eeeeeeeeeeeeeeeeee", "ffffffffffffffff", "ggggggggggg", "hhhhhhhhhhhhhh" }, { l1a={ l2a={l3a="012345678901234567890123456789012345678901234567890123456789"}, l2b="bbb" }, l1b=4 } }]] ) local t6 = { t1=t1, t2=t2, t3=t3, t4=t4 } lu.assertEquals(lu.prettystr(t6),[[{ t1={1, 2, 3, 4, 5, 6}, t2={ "aaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbb", "ccccccccccccccccc", "ddddddddddddd", "eeeeeeeeeeeeeeeeee", "ffffffffffffffff", "ggggggggggg", "hhhhhhhhhhhhhh" }, t3={ l1a={ l2a={l3a="012345678901234567890123456789012345678901234567890123456789"}, l2b="bbb" }, l1b=4 }, t4={a=1, b=2, c=3} }]]) end function TestLuaUnitUtilities:test_prettstrTableRecursion() local t = {} t.__index = t lu.assertStrMatches(lu.prettystr(t), " {__index=}") local t1 = {} local t2 = {} t1.t2 = t2 t2.t1 = t1 local t3 = { t1 = t1, t2 = t2 } lu.assertStrMatches(lu.prettystr(t1), " {t2= {t1=}}") lu.assertStrMatches(lu.prettystr(t3), [[ { t1= {t2= {t1=}}, t2= }]]) local t4 = {1,2} local t5 = {3,4,t4} t4[3] = t5 lu.assertStrMatches(lu.prettystr(t5), " {3, 4, {1, 2, }}") end function TestLuaUnitUtilities:test_IsFunction() lu.assertEquals( lu.LuaUnit.isFunction( function (a,b) end ), true ) lu.assertEquals( lu.LuaUnit.isFunction( nil ), false ) end function TestLuaUnitUtilities:test_IsClassMethod() lu.assertEquals( lu.LuaUnit.isClassMethod( 'toto' ), false ) lu.assertEquals( lu.LuaUnit.isClassMethod( 'toto.titi' ), true ) end function TestLuaUnitUtilities:test_splitClassMethod() lu.assertEquals( lu.LuaUnit.splitClassMethod( 'toto' ), nil ) v1, v2 = lu.LuaUnit.splitClassMethod( 'toto.titi' ) lu.assertEquals( {v1, v2}, {'toto', 'titi'} ) end function TestLuaUnitUtilities:test_isTestName() lu.assertEquals( lu.LuaUnit.isTestName( 'testToto' ), true ) lu.assertEquals( lu.LuaUnit.isTestName( 'TestToto' ), true ) lu.assertEquals( lu.LuaUnit.isTestName( 'TESTToto' ), true ) lu.assertEquals( lu.LuaUnit.isTestName( 'xTESTToto' ), false ) lu.assertEquals( lu.LuaUnit.isTestName( '' ), false ) end function TestLuaUnitUtilities:test_parseCmdLine() --test names lu.assertEquals( lu.LuaUnit.parseCmdLine(), {} ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { 'someTest' } ), { testNames={'someTest'} } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { 'someTest', 'someOtherTest' } ), { testNames={'someTest', 'someOtherTest'} } ) -- verbosity lu.assertEquals( lu.LuaUnit.parseCmdLine( { '--verbose' } ), { verbosity=lu.VERBOSITY_VERBOSE } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-v' } ), { verbosity=lu.VERBOSITY_VERBOSE } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '--quiet' } ), { verbosity=lu.VERBOSITY_QUIET } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-q' } ), { verbosity=lu.VERBOSITY_QUIET } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-v', '-q' } ), { verbosity=lu.VERBOSITY_QUIET } ) --output lu.assertEquals( lu.LuaUnit.parseCmdLine( { '--output', 'toto' } ), { output='toto'} ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-o', 'toto' } ), { output='toto'} ) lu.assertErrorMsgContains( 'Missing argument after -o', lu.LuaUnit.parseCmdLine, { '-o', } ) --name lu.assertEquals( lu.LuaUnit.parseCmdLine( { '--name', 'toto' } ), { fname='toto'} ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-n', 'toto' } ), { fname='toto'} ) lu.assertErrorMsgContains( 'Missing argument after -n', lu.LuaUnit.parseCmdLine, { '-n', } ) --patterns lu.assertEquals( lu.LuaUnit.parseCmdLine( { '--pattern', 'toto' } ), { pattern={'toto'} } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-p', 'toto' } ), { pattern={'toto'} } ) lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-p', 'titi', '-p', 'toto' } ), { pattern={'titi', 'toto'} } ) lu.assertErrorMsgContains( 'Missing argument after -p', lu.LuaUnit.parseCmdLine, { '-p', } ) --megamix lu.assertEquals( lu.LuaUnit.parseCmdLine( { '-p', 'toto', 'titi', '-v', 'tata', '-o', 'tintin', '-p', 'tutu', 'prout', '-n', 'toto.xml' } ), { pattern={'toto', 'tutu'}, verbosity=lu.VERBOSITY_VERBOSE, output='tintin', testNames={'titi', 'tata', 'prout'}, fname='toto.xml' } ) lu.assertErrorMsgContains( 'option: -x', lu.LuaUnit.parseCmdLine, { '-x', } ) end function TestLuaUnitUtilities:test_includePattern() lu.assertEquals( lu.LuaUnit.patternInclude( nil, 'toto'), true ) lu.assertEquals( lu.LuaUnit.patternInclude( {}, 'toto'), false ) lu.assertEquals( lu.LuaUnit.patternInclude( {'toto'}, 'toto'), true ) lu.assertEquals( lu.LuaUnit.patternInclude( {'toto'}, 'yyytotoxxx'), true ) lu.assertEquals( lu.LuaUnit.patternInclude( {'titi', 'toto'}, 'yyytotoxxx'), true ) lu.assertEquals( lu.LuaUnit.patternInclude( {'titi', 'to..'}, 'yyytoxxx'), true ) end function TestLuaUnitUtilities:test_applyPatternFilter() myTestToto1Value = { 'MyTestToto1.test1', MyTestToto1 } included, excluded = lu.LuaUnit.applyPatternFilter( nil, { myTestToto1Value } ) lu.assertEquals( excluded, {} ) lu.assertEquals( included, { myTestToto1Value } ) included, excluded = lu.LuaUnit.applyPatternFilter( {'T.to'}, { myTestToto1Value } ) lu.assertEquals( excluded, {} ) lu.assertEquals( included, { myTestToto1Value } ) included, excluded = lu.LuaUnit.applyPatternFilter( {'T.ti'}, { myTestToto1Value } ) lu.assertEquals( excluded, { myTestToto1Value } ) lu.assertEquals( included, {} ) end function TestLuaUnitUtilities:test_strMatch() lu.assertEquals( lu.private.strMatch('toto', 't.t.'), true ) lu.assertEquals( lu.private.strMatch('toto', 't.t.', 1, 4), true ) lu.assertEquals( lu.private.strMatch('toto', 't.t.', 2, 5), false ) lu.assertEquals( lu.private.strMatch('toto', '.t.t.'), false ) lu.assertEquals( lu.private.strMatch('ototo', 't.t.'), false ) lu.assertEquals( lu.private.strMatch('totot', 't.t.'), false ) lu.assertEquals( lu.private.strMatch('ototot', 't.t.'), false ) lu.assertEquals( lu.private.strMatch('ototot', 't.t.',2,3), false ) lu.assertEquals( lu.private.strMatch('ototot', 't.t.',2,5), true ) lu.assertEquals( lu.private.strMatch('ototot', 't.t.',2,6), false ) end function TestLuaUnitUtilities:test_expandOneClass() local result = {} lu.LuaUnit.expandOneClass( result, 'titi', {} ) lu.assertEquals( result, {} ) result = {} lu.LuaUnit.expandOneClass( result, 'MyTestToto1', MyTestToto1 ) lu.assertEquals( result, { {'MyTestToto1.test1', MyTestToto1 }, {'MyTestToto1.test2', MyTestToto1 }, {'MyTestToto1.test3', MyTestToto1 }, {'MyTestToto1.testa', MyTestToto1 }, {'MyTestToto1.testb', MyTestToto1 }, } ) end function TestLuaUnitUtilities:test_expandClasses() local result = {} result = lu.LuaUnit.expandClasses( {} ) lu.assertEquals( result, {} ) result = lu.LuaUnit.expandClasses( { { 'MyTestFunction', MyTestFunction } } ) lu.assertEquals( result, { { 'MyTestFunction', MyTestFunction } } ) result = lu.LuaUnit.expandClasses( { { 'MyTestToto1.test1', MyTestToto1 } } ) lu.assertEquals( result, { { 'MyTestToto1.test1', MyTestToto1 } } ) result = lu.LuaUnit.expandClasses( { { 'MyTestToto1', MyTestToto1 } } ) lu.assertEquals( result, { {'MyTestToto1.test1', MyTestToto1 }, {'MyTestToto1.test2', MyTestToto1 }, {'MyTestToto1.test3', MyTestToto1 }, {'MyTestToto1.testa', MyTestToto1 }, {'MyTestToto1.testb', MyTestToto1 }, } ) end function TestLuaUnitUtilities:test_xmlEscape() lu.assertEquals( lu.private.xmlEscape( 'abc' ), 'abc' ) lu.assertEquals( lu.private.xmlEscape( 'a"bc' ), 'a"bc' ) lu.assertEquals( lu.private.xmlEscape( "a'bc" ), 'a'bc' ) lu.assertEquals( lu.private.xmlEscape( "a" ), 'a<b&c>' ) end function TestLuaUnitUtilities:test_xmlCDataEscape() lu.assertEquals( lu.private.xmlCDataEscape( 'abc' ), 'abc' ) lu.assertEquals( lu.private.xmlCDataEscape( 'a"bc' ), 'a"bc' ) lu.assertEquals( lu.private.xmlCDataEscape( "a'bc" ), "a'bc" ) lu.assertEquals( lu.private.xmlCDataEscape( "a" ), 'a' ) lu.assertEquals( lu.private.xmlCDataEscape( "a--" ), 'a [C]: in function 'xpcall' ./luaunit.lua:1449: in function 'protectedCall' ./luaunit.lua:1508: in function 'execOneFunction' ./luaunit.lua:1596: in function 'runSuiteByInstances' ./luaunit.lua:1660: in function 'runSuiteByNames' ./luaunit.lua:1736: in function 'runSuite' example_with_luaunit.lua:140: in main chunk [C]: in ?]] local realStackTrace2=[[stack traceback: ./luaunit.lua:545: in function 'lu.assertEquals' example_with_luaunit.lua:58: in function 'TestToto.test7' ./luaunit.lua:1517: in function <./luaunit.lua:1517> [C]: in function 'xpcall' ./luaunit.lua:1517: in function 'protectedCall' ./luaunit.lua:1578: in function 'execOneFunction' ./luaunit.lua:1677: in function 'runSuiteByInstances' ./luaunit.lua:1730: in function 'runSuiteByNames' ./luaunit.lua:1806: in function 'runSuite' example_with_luaunit.lua:140: in main chunk [C]: in ?]] local realStackTrace3 = [[stack traceback: luaunit2/example_with_luaunit.lua:124: in function 'test1_withFailure' luaunit2/luaunit.lua:1532: in function [C]: in function 'xpcall' luaunit2/luaunit.lua:1532: in function 'protectedCall' luaunit2/luaunit.lua:1591: in function 'execOneFunction' luaunit2/luaunit.lua:1679: in function 'runSuiteByInstances' luaunit2/luaunit.lua:1743: in function 'runSuiteByNames' luaunit2/luaunit.lua:1819: in function 'runSuite' luaunit2/example_with_luaunit.lua:140: in main chunk [C]: in ?]] local strippedStackTrace=lu.private.stripLuaunitTrace( realStackTrace ) -- print( strippedStackTrace ) local expectedStackTrace=[[stack traceback: example_with_luaunit.lua:130: in function 'test2_withFailure']] lu.assertEquals( strippedStackTrace, expectedStackTrace ) strippedStackTrace=lu.private.stripLuaunitTrace( realStackTrace2 ) expectedStackTrace=[[stack traceback: example_with_luaunit.lua:58: in function 'TestToto.test7']] lu.assertEquals( strippedStackTrace, expectedStackTrace ) strippedStackTrace=lu.private.stripLuaunitTrace( realStackTrace3 ) expectedStackTrace=[[stack traceback: luaunit2/example_with_luaunit.lua:124: in function 'test1_withFailure']] lu.assertEquals( strippedStackTrace, expectedStackTrace ) end ------------------------------------------------------------------ -- -- Assertion Tests -- ------------------------------------------------------------------ TestLuaUnitAssertions = {} --class TestLuaUnitAssertions.__class__ = 'TestLuaUnitAssertions' function TestLuaUnitAssertions:test_assertEquals() f = function() return true end g = function() return true end lu.assertEquals( 1, 1 ) lu.assertEquals( "abc", "abc" ) lu.assertEquals( nil, nil ) lu.assertEquals( true, true ) lu.assertEquals( f, f) lu.assertEquals( {1,2,3}, {1,2,3}) lu.assertEquals( {one=1,two=2,three=3}, {one=1,two=2,three=3}) lu.assertEquals( {one=1,two=2,three=3}, {two=2,three=3,one=1}) lu.assertEquals( {one=1,two={1,2},three=3}, {two={1,2},three=3,one=1}) lu.assertEquals( {one=1,two={1,{2,nil}},three=3}, {two={1,{2,nil}},three=3,one=1}) lu.assertEquals( {nil}, {nil} ) lu.assertError( lu.assertEquals, 1, 2) lu.assertError( lu.assertEquals, 1, "abc" ) lu.assertError( lu.assertEquals, 0, nil ) lu.assertError( lu.assertEquals, false, nil ) lu.assertError( lu.assertEquals, true, 1 ) lu.assertError( lu.assertEquals, f, 1 ) lu.assertError( lu.assertEquals, f, g ) lu.assertError( lu.assertEquals, {1,2,3}, {2,1,3} ) lu.assertError( lu.assertEquals, {1,2,3}, nil ) lu.assertError( lu.assertEquals, {1,2,3}, 1 ) lu.assertError( lu.assertEquals, {1,2,3}, true ) lu.assertError( lu.assertEquals, {1,2,3}, {one=1,two=2,three=3} ) lu.assertError( lu.assertEquals, {1,2,3}, {one=1,two=2,three=3,four=4} ) lu.assertError( lu.assertEquals, {one=1,two=2,three=3}, {2,1,3} ) lu.assertError( lu.assertEquals, {one=1,two=2,three=3}, nil ) lu.assertError( lu.assertEquals, {one=1,two=2,three=3}, 1 ) lu.assertError( lu.assertEquals, {one=1,two=2,three=3}, true ) lu.assertError( lu.assertEquals, {one=1,two=2,three=3}, {1,2,3} ) lu.assertError( lu.assertEquals, {one=1,two={1,2},three=3}, {two={2,1},three=3,one=1}) end function TestLuaUnitAssertions:test_assertAlmostEquals() lu.assertAlmostEquals( 1, 1, 0.1 ) lu.assertAlmostEquals( 1, 1.1, 0.2 ) lu.assertAlmostEquals( -1, -1.1, 0.2 ) lu.assertAlmostEquals( 0.1, -0.1, 0.3 ) lu.assertAlmostEquals( 1, 1.1, 0.1 ) lu.assertAlmostEquals( -1, -1.1, 0.1 ) lu.assertAlmostEquals( 0.1, -0.1, 0.2 ) lu.assertError( lu.assertAlmostEquals, 1, 1.11, 0.1 ) lu.assertError( lu.assertAlmostEquals, -1, -1.11, 0.1 ) lu.assertError( lu.assertAlmostEquals, -1, 1, nil ) lu.assertError( lu.assertAlmostEquals, -1, nil, 0 ) lu.assertError( lu.assertAlmostEquals, 1, 1.1, 0 ) lu.assertError( lu.assertAlmostEquals, 1, 1.1, -0.1 ) end function TestLuaUnitAssertions:test_assertNotEquals() f = function() return true end g = function() return true end lu.assertNotEquals( 1, 2 ) lu.assertNotEquals( "abc", 2 ) lu.assertNotEquals( "abc", "def" ) lu.assertNotEquals( 1, 2) lu.assertNotEquals( 1, "abc" ) lu.assertNotEquals( 0, nil ) lu.assertNotEquals( false, nil ) lu.assertNotEquals( true, 1 ) lu.assertNotEquals( f, 1 ) lu.assertNotEquals( f, g ) lu.assertNotEquals( {one=1,two=2,three=3}, true ) lu.assertNotEquals( {one=1,two={1,2},three=3}, {two={2,1},three=3,one=1} ) lu.assertError( lu.assertNotEquals, 1, 1) lu.assertError( lu.assertNotEquals, "abc", "abc" ) lu.assertError( lu.assertNotEquals, nil, nil ) lu.assertError( lu.assertNotEquals, true, true ) lu.assertError( lu.assertNotEquals, f, f) lu.assertError( lu.assertNotEquals, {one=1,two={1,{2,nil}},three=3}, {two={1,{2,nil}},three=3,one=1}) end function TestLuaUnitAssertions:test_assertNotAlmostEquals() lu.assertNotAlmostEquals( 1, 1.2, 0.1 ) lu.assertNotAlmostEquals( 1, 1.3, 0.2 ) lu.assertNotAlmostEquals( -1, -1.3, 0.2 ) lu.assertNotAlmostEquals( 0.1, -0.1, 0.1 ) lu.assertNotAlmostEquals( 1, 1.1, 0.09 ) lu.assertNotAlmostEquals( -1, -1.1, 0.09 ) lu.assertNotAlmostEquals( 0.1, -0.1, 0.11 ) lu.assertError( lu.assertNotAlmostEquals, 1, 1.11, 0.2 ) lu.assertError( lu.assertNotAlmostEquals, -1, -1.11, 0.2 ) lu.assertError( lu.assertNotAlmostEquals, -1, 1, nil ) lu.assertError( lu.assertNotAlmostEquals, -1, nil, 0 ) lu.assertError( lu.assertNotAlmostEquals, 1, 1.1, 0 ) lu.assertError( lu.assertNotAlmostEquals, 1, 1.1, -0.1 ) end function TestLuaUnitAssertions:test_assertNotEqualsDifferentTypes2() lu.assertNotEquals( 2, "abc" ) end function TestLuaUnitAssertions:test_assertTrue() lu.assertTrue(true) lu.assertError( lu.assertTrue, false) lu.assertTrue(0) lu.assertTrue(1) lu.assertTrue("") lu.assertTrue("abc") lu.assertError( lu.assertTrue, nil ) lu.assertTrue( function() return true end ) lu.assertTrue( {} ) lu.assertTrue( { 1 } ) end function TestLuaUnitAssertions:test_assertFalse() lu.assertFalse(false) lu.assertError( lu.assertFalse, true) lu.assertFalse( nil ) lu.assertError( lu.assertFalse, 0 ) lu.assertError( lu.assertFalse, 1 ) lu.assertError( lu.assertFalse, "" ) lu.assertError( lu.assertFalse, "abc" ) lu.assertError( lu.assertFalse, function() return true end ) lu.assertError( lu.assertFalse, {} ) lu.assertError( lu.assertFalse, { 1 } ) end function TestLuaUnitAssertions:test_assertNil() lu.assertNil(nil) lu.assertError( lu.assertTrue, false) lu.assertError( lu.assertNil, 0) lu.assertError( lu.assertNil, "") lu.assertError( lu.assertNil, "abc") lu.assertError( lu.assertNil, function() return true end ) lu.assertError( lu.assertNil, {} ) lu.assertError( lu.assertNil, { 1 } ) end function TestLuaUnitAssertions:test_assertNotNil() lu.assertError( lu.assertNotNil, nil) lu.assertNotNil( false ) lu.assertNotNil( 0 ) lu.assertNotNil( "" ) lu.assertNotNil( "abc" ) lu.assertNotNil( function() return true end ) lu.assertNotNil( {} ) lu.assertNotNil( { 1 } ) end function TestLuaUnitAssertions:test_assertStrContains() lu.assertStrContains( 'abcdef', 'abc' ) lu.assertStrContains( 'abcdef', 'bcd' ) lu.assertStrContains( 'abcdef', 'abcdef' ) lu.assertStrContains( 'abc0', 0 ) lu.assertError( lu.assertStrContains, 'ABCDEF', 'abc' ) lu.assertError( lu.assertStrContains, '', 'abc' ) lu.assertStrContains( 'abcdef', '' ) lu.assertError( lu.assertStrContains, 'abcdef', 'abcx' ) lu.assertError( lu.assertStrContains, 'abcdef', 'abcdefg' ) lu.assertError( lu.assertStrContains, 'abcdef', 0 ) lu.assertError( lu.assertStrContains, 'abcdef', {} ) lu.assertError( lu.assertStrContains, 'abcdef', nil ) lu.assertStrContains( 'abcdef', 'abc', false ) lu.assertStrContains( 'abcdef', 'abc', true ) lu.assertStrContains( 'abcdef', 'a.c', true ) lu.assertError( lu.assertStrContains, 'abcdef', '.abc', true ) end function TestLuaUnitAssertions:test_assertStrIContains() lu.assertStrIContains( 'ABcdEF', 'aBc' ) lu.assertStrIContains( 'abCDef', 'bcd' ) lu.assertStrIContains( 'abcdef', 'abcDef' ) lu.assertError( lu.assertStrIContains, '', 'aBc' ) lu.assertStrIContains( 'abcDef', '' ) lu.assertError( lu.assertStrIContains, 'abcdef', 'abcx' ) lu.assertError( lu.assertStrIContains, 'abcdef', 'abcdefg' ) end function TestLuaUnitAssertions:test_assertNotStrContains() lu.assertError( lu.assertNotStrContains, 'abcdef', 'abc' ) lu.assertError( lu.assertNotStrContains, 'abcdef', 'bcd' ) lu.assertError( lu.assertNotStrContains, 'abcdef', 'abcdef' ) lu.assertNotStrContains( '', 'abc' ) lu.assertError( lu.assertNotStrContains, 'abcdef', '' ) lu.assertError( lu.assertNotStrContains, 'abc0', 0 ) lu.assertNotStrContains( 'abcdef', 'abcx' ) lu.assertNotStrContains( 'abcdef', 'abcdefg' ) lu.assertError( lu.assertNotStrContains, 'abcdef', {} ) lu.assertError( lu.assertNotStrContains, 'abcdef', nil ) lu.assertError( lu.assertNotStrContains, 'abcdef', 'abc', false ) lu.assertError( lu.assertNotStrContains, 'abcdef', 'a.c', true ) lu.assertNotStrContains( 'abcdef', 'a.cx', true ) end function TestLuaUnitAssertions:test_assertNotStrIContains() lu.assertError( lu.assertNotStrIContains, 'aBcdef', 'abc' ) lu.assertError( lu.assertNotStrIContains, 'abcdef', 'aBc' ) lu.assertError( lu.assertNotStrIContains, 'abcdef', 'bcd' ) lu.assertError( lu.assertNotStrIContains, 'abcdef', 'abcdef' ) lu.assertNotStrIContains( '', 'abc' ) lu.assertError( lu.assertNotStrIContains, 'abcdef', '' ) lu.assertError( lu.assertNotStrIContains, 'abc0', 0 ) lu.assertNotStrIContains( 'abcdef', 'abcx' ) lu.assertNotStrIContains( 'abcdef', 'abcdefg' ) lu.assertError( lu.assertNotStrIContains, 'abcdef', {} ) lu.assertError( lu.assertNotStrIContains, 'abcdef', nil ) end function TestLuaUnitAssertions:test_assertStrMatches() lu.assertStrMatches( 'abcdef', 'abcdef' ) lu.assertStrMatches( 'abcdef', '..cde.' ) lu.assertError( lu.assertStrMatches, 'abcdef', '..def') lu.assertError( lu.assertStrMatches, 'abCDEf', '..cde.') lu.assertStrMatches( 'abcdef', 'bcdef', 2 ) lu.assertStrMatches( 'abcdef', 'bcde', 2, 5 ) lu.assertStrMatches( 'abcdef', 'b..e', 2, 5 ) lu.assertStrMatches( 'abcdef', 'ab..e', nil, 5 ) lu.assertError( lu.assertStrMatches, 'abcdef', '' ) lu.assertError( lu.assertStrMatches, '', 'abcdef' ) lu.assertError( lu.assertStrMatches, 'abcdef', 0 ) lu.assertError( lu.assertStrMatches, 'abcdef', {} ) lu.assertError( lu.assertStrMatches, 'abcdef', nil ) end function TestLuaUnitAssertions:test_assertItemsEquals() lu.assertItemsEquals(nil, nil) lu.assertItemsEquals({},{}) lu.assertItemsEquals({1,2,3}, {3,1,2}) lu.assertItemsEquals({nil},{nil}) lu.assertItemsEquals({one=1,two=2,three=3}, {two=2,one=1,three=3}) lu.assertItemsEquals({one=1,two=2,three=3}, {a=1,b=2,c=3}) lu.assertItemsEquals({1,2,three=3}, {3,1,two=2}) lu.assertError(assertItemsEquals, {1}, {}) lu.assertError(assertItemsEquals, nil, {1,2,3}) lu.assertError(assertItemsEquals, {1,2,3}, nil) lu.assertError(assertItemsEquals, {1,2,3,4}, {3,1,2}) lu.assertError(assertItemsEquals, {1,2,3}, {3,1,2,4}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3,four=4}, {a=1,b=2,c=3}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {a=1,b=2,c=3,d=4}) lu.assertError(assertItemsEquals, {1,2,three=3}, {3,4,a=1,b=2}) lu.assertError(assertItemsEquals, {1,2,three=3,four=4}, {3,a=1,b=2}) lu.assertItemsEquals({one=1,two={1,2},three=3}, {one={1,2},two=1,three=3}) lu.assertItemsEquals({one=1, two={1,{3,2,one=1}}, three=3}, {two={1,{3,2,one=1}}, one=1, three=3}) -- itemsEquals is not recursive: lu.assertError( lu.assertItemsEquals,{1,{2,1},3}, {3,1,{1,2}}) lu.assertError( lu.assertItemsEquals,{one=1,two={1,2},three=3}, {one={2,1},two=1,three=3}) lu.assertError( lu.assertItemsEquals,{one=1,two={1,{3,2,one=1}},three=3}, {two={{3,one=1,2},1},one=1,three=3}) lu.assertError( lu.assertItemsEquals,{one=1,two={1,{3,2,one=1}},three=3}, {two={{3,2,one=1},1},one=1,three=3}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {two=2,one=1,three=2}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {two=2,one=1,four=4}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {two=2,one=1,'three'}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {two=2,one=1,nil}) lu.assertError(assertItemsEquals, {one=1,two=2,three=3}, {two=2,one=1}) end function TestLuaUnitAssertions:test_assertIsNumber() lu.assertIsNumber(1) lu.assertIsNumber(1.4) lu.assertError(assertIsNumber, "hi there!") lu.assertError(assertIsNumber, nil) lu.assertError(assertIsNumber, {}) lu.assertError(assertIsNumber, {1,2,3}) lu.assertError(assertIsNumber, {1}) lu.assertError(assertIsNumber, coroutine.create( function(v) local y=v+1 end ) ) lu.assertError(assertIsTable, true) end function TestLuaUnitAssertions:test_assertIsString() lu.assertError(assertIsString, 1) lu.assertError(assertIsString, 1.4) lu.assertIsString("hi there!") lu.assertError(assertIsString, nil) lu.assertError(assertIsString, {}) lu.assertError(assertIsString, {1,2,3}) lu.assertError(assertIsString, {1}) lu.assertError(assertIsString, coroutine.create( function(v) local y=v+1 end ) ) lu.assertError(assertIsTable, true) end function TestLuaUnitAssertions:test_assertIsTable() lu.assertError(assertIsTable, 1) lu.assertError(assertIsTable, 1.4) lu.assertError(assertIsTable, "hi there!") lu.assertError(assertIsTable, nil) lu.assertIsTable({}) lu.assertIsTable({1,2,3}) lu.assertIsTable({1}) lu.assertError(assertIsTable, true) lu.assertError(assertIsTable, coroutine.create( function(v) local y=v+1 end ) ) end function TestLuaUnitAssertions:test_assertIsBoolean() lu.assertError(assertIsBoolean, 1) lu.assertError(assertIsBoolean, 1.4) lu.assertError(assertIsBoolean, "hi there!") lu.assertError(assertIsBoolean, nil) lu.assertError(assertIsBoolean, {}) lu.assertError(assertIsBoolean, {1,2,3}) lu.assertError(assertIsBoolean, {1}) lu.assertError(assertIsBoolean, coroutine.create( function(v) local y=v+1 end ) ) lu.assertIsBoolean(true) lu.assertIsBoolean(false) end function TestLuaUnitAssertions:test_assertIsNil() lu.assertError(assertIsNil, 1) lu.assertError(assertIsNil, 1.4) lu.assertError(assertIsNil, "hi there!") lu.assertIsNil(nil) lu.assertError(assertIsNil, {}) lu.assertError(assertIsNil, {1,2,3}) lu.assertError(assertIsNil, {1}) lu.assertError(assertIsNil, false) lu.assertError(assertIsNil, coroutine.create( function(v) local y=v+1 end ) ) end function TestLuaUnitAssertions:test_assertIsFunction() f = function() return true end lu.assertError(assertIsFunction, 1) lu.assertError(assertIsFunction, 1.4) lu.assertError(assertIsFunction, "hi there!") lu.assertError(assertIsFunction, nil) lu.assertError(assertIsFunction, {}) lu.assertError(assertIsFunction, {1,2,3}) lu.assertError(assertIsFunction, {1}) lu.assertError(assertIsFunction, false) lu.assertError(assertIsFunction, coroutine.create( function(v) local y=v+1 end ) ) lu.assertIsFunction(f) end function TestLuaUnitAssertions:test_assertIsCoroutine() lu.assertError(assertIsCoroutine, 1) lu.assertError(assertIsCoroutine, 1.4) lu.assertError(assertIsCoroutine, "hi there!") lu.assertError(assertIsCoroutine, nil) lu.assertError(assertIsCoroutine, {}) lu.assertError(assertIsCoroutine, {1,2,3}) lu.assertError(assertIsCoroutine, {1}) lu.assertError(assertIsCoroutine, false) lu.assertError(assertIsCoroutine, function(v) local y=v+1 end ) lu.assertIsCoroutine(coroutine.create( function(v) local y=v+1 end ) ) end function TestLuaUnitAssertions:test_assertIsUserdata() lu.assertError(assertIsUserdata, 1) lu.assertError(assertIsUserdata, 1.4) lu.assertError(assertIsUserdata, "hi there!") lu.assertError(assertIsUserdata, nil) lu.assertError(assertIsUserdata, {}) lu.assertError(assertIsUserdata, {1,2,3}) lu.assertError(assertIsUserdata, {1}) lu.assertError(assertIsUserdata, false) lu.assertError(assertIsUserdata, function(v) local y=v+1 end ) lu.assertError(assertIsUserdata, coroutine.create( function(v) local y=v+1 end ) ) end function TestLuaUnitAssertions:test_assertIs() local f = function() return true end local g = function() return true end local t1= {} local t2={1,2} local t3={1,2} local t4= {a=1,{1,2},day="today"} local s1='toto' local s2='toto' local s3='to'..'to' lu.assertIs(1,1) lu.assertIs(f,f) lu.assertIs('toto', 'toto') lu.assertIs(s1, s2) lu.assertIs(s1, s3) lu.assertIs(t1,t1) lu.assertIs(t4,t4) lu.assertError(assertIs, 1, 2) lu.assertError(assertIs, 1.4, 1) lu.assertError(assertIs, "hi there!", "hola") lu.assertError(assertIs, nil, 1) lu.assertError(assertIs, {}, {}) lu.assertError(assertIs, {1,2,3}, f) lu.assertError(assertIs, f, g) lu.assertError(assertIs, t2,t3 ) end function TestLuaUnitAssertions:test_assertNotIs() local f = function() return true end local g = function() return true end local t1= {} local t2={1,2} local t3={1,2} local t4= {a=1,{1,2},day="today"} local s1='toto' local s2='toto' lu.assertError( lu.assertNotIs, 1,1 ) lu.assertError( lu.assertNotIs, f,f ) lu.assertError( lu.assertNotIs, t1,t1 ) lu.assertError( lu.assertNotIs, t4,t4) lu.assertError( lu.assertNotIs, s1,s2 ) lu.assertError( lu.assertNotIs, 'toto', 'toto' ) lu.assertNotIs(1, 2) lu.assertNotIs(1.4, 1) lu.assertNotIs("hi there!", "hola") lu.assertNotIs(nil, 1) lu.assertNotIs({}, {}) lu.assertNotIs({1,2,3}, f) lu.assertNotIs(f, g) lu.assertNotIs(t2,t3) end function TestLuaUnitAssertions:test_assertTableNum() lu.assertEquals( 3, 3 ) lu.assertNotEquals( 3, 4 ) lu.assertEquals( {3}, {3} ) lu.assertNotEquals( {3}, 3 ) lu.assertNotEquals( {3}, {4} ) lu.assertEquals( {x=1}, {x=1} ) lu.assertNotEquals( {x=1}, {x=2} ) lu.assertNotEquals( {x=1}, {y=1} ) end function TestLuaUnitAssertions:test_assertTableStr() lu.assertEquals( '3', '3' ) lu.assertNotEquals( '3', '4' ) lu.assertEquals( {'3'}, {'3'} ) lu.assertNotEquals( {'3'}, '3' ) lu.assertNotEquals( {'3'}, {'4'} ) lu.assertEquals( {x='1'}, {x='1'} ) lu.assertNotEquals( {x='1'}, {x='2'} ) lu.assertNotEquals( {x='1'}, {y='1'} ) end function TestLuaUnitAssertions:test_assertTableLev2() lu.assertEquals( {x={'a'}}, {x={'a'}} ) lu.assertNotEquals( {x={'a'}}, {x={'b'}} ) lu.assertNotEquals( {x={'a'}}, {z={'a'}} ) lu.assertEquals( {{x=1}}, {{x=1}} ) lu.assertNotEquals( {{x=1}}, {{y=1}} ) lu.assertEquals( {{x='a'}}, {{x='a'}} ) lu.assertNotEquals( {{x='a'}}, {{x='b'}} ) end function TestLuaUnitAssertions:test_assertTableList() lu.assertEquals( {3,4,5}, {3,4,5} ) lu.assertNotEquals( {3,4,5}, {3,4,6} ) lu.assertNotEquals( {3,4,5}, {3,5,4} ) lu.assertEquals( {3,4,x=5}, {3,4,x=5} ) lu.assertNotEquals( {3,4,x=5}, {3,4,x=6} ) lu.assertNotEquals( {3,4,x=5}, {3,x=4,5} ) lu.assertNotEquals( {3,4,5}, {2,3,4,5} ) lu.assertNotEquals( {3,4,5}, {3,2,4,5} ) lu.assertNotEquals( {3,4,5}, {3,4,5,6} ) end function TestLuaUnitAssertions:test_assertTableNil() lu.assertEquals( {3,4,5}, {3,4,5} ) lu.assertNotEquals( {3,4,5}, {nil,3,4,5} ) lu.assertNotEquals( {3,4,5}, {nil,4,5} ) lu.assertEquals( {3,4,5}, {3,4,5,nil} ) -- lua quirk lu.assertNotEquals( {3,4,5}, {3,4,nil} ) lu.assertNotEquals( {3,4,5}, {3,nil,5} ) lu.assertNotEquals( {3,4,5}, {3,4,nil,5} ) end function TestLuaUnitAssertions:test_assertTableNilFront() lu.assertEquals( {nil,4,5}, {nil,4,5} ) lu.assertNotEquals( {nil,4,5}, {nil,44,55} ) lu.assertEquals( {nil,'4','5'}, {nil,'4','5'} ) lu.assertNotEquals( {nil,'4','5'}, {nil,'44','55'} ) lu.assertEquals( {nil,{4,5}}, {nil,{4,5}} ) lu.assertNotEquals( {nil,{4,5}}, {nil,{44,55}} ) lu.assertNotEquals( {nil,{4}}, {nil,{44}} ) lu.assertEquals( {nil,{x=4,5}}, {nil,{x=4,5}} ) lu.assertEquals( {nil,{x=4,5}}, {nil,{5,x=4}} ) -- lua quirk lu.assertEquals( {nil,{x=4,y=5}}, {nil,{y=5,x=4}} ) -- lua quirk lu.assertNotEquals( {nil,{x=4,5}}, {nil,{y=4,5}} ) end function TestLuaUnitAssertions:test_assertTableAdditions() lu.assertEquals( {1,2,3}, {1,2,3} ) lu.assertNotEquals( {1,2,3}, {1,2,3,4} ) lu.assertNotEquals( {1,2,3,4}, {1,2,3} ) lu.assertEquals( {1,x=2,3}, {1,x=2,3} ) lu.assertNotEquals( {1,x=2,3}, {1,x=2,3,y=4} ) lu.assertNotEquals( {1,x=2,3,y=4}, {1,x=2,3} ) end TestLuaUnitAssertionsError = {} function TestLuaUnitAssertionsError:setUp() self.f = function ( v ) local y = v + 1 end self.f_with_error = function (v) local y = v + 2 error('This is an error', 2) end end function TestLuaUnitAssertionsError:test_assertError() local x = 1 -- f_with_error generates an error has_error = not pcall( self.f_with_error, x ) lu.assertEquals( has_error, true ) -- f does not generate an error has_error = not pcall( self.f, x ) lu.assertEquals( has_error, false ) -- lu.assertError is happy with f_with_error lu.assertError( self.f_with_error, x ) -- lu.assertError is unhappy with f has_error = not pcall( lu.assertError, self.f, x ) lu.assertError( has_error, true ) -- multiple arguments local function f_with_multi_arguments(a,b,c) if a == b and b == c then return end error("three arguments not equal") end lu.assertError( f_with_multi_arguments, 1, 1, 3 ) lu.assertError( f_with_multi_arguments, 1, 3, 1 ) lu.assertError( f_with_multi_arguments, 3, 1, 1 ) has_error = not pcall( lu.assertError, f_with_multi_arguments, 1, 1, 1 ) lu.assertEquals( has_error, true ) end function TestLuaUnitAssertionsError:test_assertErrorMsgContains() local x = 1 lu.assertError( lu.assertErrorMsgContains, 'toto', self.f, x ) lu.assertErrorMsgContains( 'is an err', self.f_with_error, x ) lu.assertErrorMsgContains( 'This is an error', self.f_with_error, x ) lu.assertError( lu.assertErrorMsgContains, ' This is an error', self.f_with_error, x ) lu.assertError( lu.assertErrorMsgContains, 'This .. an error', self.f_with_error, x ) end function TestLuaUnitAssertionsError:test_assertErrorMsgEquals() local x = 1 lu.assertError( lu.assertErrorMsgEquals, 'toto', self.f, x ) lu.assertError( lu.assertErrorMsgEquals, 'is an err', self.f_with_error, x ) lu.assertErrorMsgEquals( 'This is an error', self.f_with_error, x ) lu.assertError( lu.assertErrorMsgEquals, ' This is an error', self.f_with_error, x ) lu.assertError( lu.assertErrorMsgEquals, 'This .. an error', self.f_with_error, x ) end function TestLuaUnitAssertionsError:test_assertErrorMsgMatches() local x = 1 lu.assertError( lu.assertErrorMsgMatches, 'toto', self.f, x ) lu.assertError( lu.assertErrorMsgMatches, 'is an err', self.f_with_error, x ) lu.assertErrorMsgMatches( 'This is an error', self.f_with_error, x ) lu.assertErrorMsgMatches( 'This is .. error', self.f_with_error, x ) lu.assertError( lu.assertErrorMsgMatches, ' This is an error', self.f_with_error, x ) end ------------------------------------------------------------------ -- -- Error message tests -- ------------------------------------------------------------------ TestLuaUnitErrorMsg = {} --class TestLuaUnitErrorMsg.__class__ = 'TestLuaUnitErrorMsg' function TestLuaUnitErrorMsg:setUp() self.old_ORDER_ACTUAL_EXPECTED = lu.ORDER_ACTUAL_EXPECTED self.old_PRINT_TABLE_REF_IN_ERROR_MSG = lu.PRINT_TABLE_REF_IN_ERROR_MSG end function TestLuaUnitErrorMsg:tearDown() lu.ORDER_ACTUAL_EXPECTED = self.old_ORDER_ACTUAL_EXPECTED lu.PRINT_TABLE_REF_IN_ERROR_MSG = self.old_PRINT_TABLE_REF_IN_ERROR_MSG end function TestLuaUnitErrorMsg:test_assertEqualsMsg() lu.assertErrorMsgEquals( 'expected: 2, actual: 1', lu.assertEquals, 1, 2 ) lu.assertErrorMsgEquals( 'expected: "exp"\nactual: "act"', lu.assertEquals, 'act', 'exp' ) lu.assertErrorMsgEquals( 'expected: \n"exp\npxe"\nactual: \n"act\ntca"', lu.assertEquals, 'act\ntca', 'exp\npxe' ) lu.assertErrorMsgEquals( 'expected: true, actual: false', lu.assertEquals, false, true ) lu.assertErrorMsgEquals( 'expected: 1.2, actual: 1', lu.assertEquals, 1.0, 1.2) lu.assertErrorMsgMatches( 'expected: {1, 2, 3}\nactual: {3, 2, 1}', lu.assertEquals, {3,2,1}, {1,2,3} ) lu.assertErrorMsgMatches( 'expected: {one=1, two=2}\nactual: {3, 2, 1}', lu.assertEquals, {3,2,1}, {one=1,two=2} ) lu.assertErrorMsgEquals( 'expected: 2, actual: nil', lu.assertEquals, nil, 2 ) end function TestLuaUnitErrorMsg:test_assertEqualsOrderReversedMsg() lu.ORDER_ACTUAL_EXPECTED = false lu.assertErrorMsgEquals( 'expected: 1, actual: 2', lu.assertEquals, 1, 2 ) lu.assertErrorMsgEquals( 'expected: "act"\nactual: "exp"', lu.assertEquals, 'act', 'exp' ) end function TestLuaUnitErrorMsg:test_assertAlmostEqualsMsg() lu.assertErrorMsgEquals('Values are not almost equal\nExpected: 1 with margin of 0.1, received: 2', lu.assertAlmostEquals, 2, 1, 0.1 ) end function TestLuaUnitErrorMsg:test_assertAlmostEqualsOrderReversedMsg() lu.ORDER_ACTUAL_EXPECTED = false lu.assertErrorMsgEquals('Values are not almost equal\nExpected: 2 with margin of 0.1, received: 1', lu.assertAlmostEquals, 2, 1, 0.1 ) end function TestLuaUnitErrorMsg:test_assertNotAlmostEqualsMsg() lu.assertErrorMsgEquals('Values are almost equal\nExpected: 1 with a difference above margin of 0.2, received: 1.1', lu.assertNotAlmostEquals, 1.1, 1, 0.2 ) end function TestLuaUnitErrorMsg:test_assertNotAlmostEqualsMsg() lu.ORDER_ACTUAL_EXPECTED = false lu.assertErrorMsgEquals('Values are almost equal\nExpected: 1.1 with a difference above margin of 0.2, received: 1', lu.assertNotAlmostEquals, 1.1, 1, 0.2 ) end function TestLuaUnitErrorMsg:test_assertNotEqualsMsg() lu.assertErrorMsgEquals( 'Received the not expected value: 1', lu.assertNotEquals, 1, 1 ) lu.assertErrorMsgMatches( 'Received the not expected value: {1, 2}', lu.assertNotEquals, {1,2}, {1,2} ) lu.assertErrorMsgEquals( 'Received the not expected value: nil', lu.assertNotEquals, nil, nil ) end function TestLuaUnitErrorMsg:test_assertNotEqualsOrderReversedMsg() lu.ORDER_ACTUAL_EXPECTED = false lu.assertErrorMsgEquals( 'Received the not expected value: 1', lu.assertNotEquals, 1, 1 ) end function TestLuaUnitErrorMsg:test_assertTrueFalse() lu.assertErrorMsgEquals( 'expected: true, actual: false', lu.assertTrue, false ) lu.assertErrorMsgEquals( 'expected: true, actual: nil', lu.assertTrue, nil ) lu.assertErrorMsgEquals( 'expected: false, actual: true', lu.assertFalse, true ) lu.assertErrorMsgEquals( 'expected: false, actual: 0', lu.assertFalse, 0) lu.assertErrorMsgMatches( 'expected: false, actual: {}', lu.assertFalse, {}) lu.assertErrorMsgEquals( 'expected: false, actual: "abc"', lu.assertFalse, 'abc') lu.assertErrorMsgContains( 'expected: false, actual: function', lu.assertFalse, function () end ) end function TestLuaUnitErrorMsg:test_assertNil() lu.assertErrorMsgEquals( 'expected: nil, actual: false', lu.assertNil, false ) lu.assertErrorMsgEquals( 'expected non nil value, received nil', lu.assertNotNil, nil ) end function TestLuaUnitErrorMsg:test_assertStrContains() lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'xxx' ) lu.assertErrorMsgEquals( 'Error, substring "aBc" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'aBc' ) lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string ""', lu.assertStrContains, '', 'xxx' ) lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'xxx', false ) lu.assertErrorMsgEquals( 'Error, substring "aBc" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'aBc', false ) lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string ""', lu.assertStrContains, '', 'xxx', false ) lu.assertErrorMsgEquals( 'Error, regexp "xxx" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'xxx', true ) lu.assertErrorMsgEquals( 'Error, regexp "aBc" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'aBc', true ) lu.assertErrorMsgEquals( 'Error, regexp "xxx" was not found in string ""', lu.assertStrContains, '', 'xxx', true ) end function TestLuaUnitErrorMsg:test_assertStrIContains() lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string "abcdef"', lu.assertStrContains, 'abcdef', 'xxx' ) lu.assertErrorMsgEquals( 'Error, substring "xxx" was not found in string ""', lu.assertStrContains, '', 'xxx' ) end function TestLuaUnitErrorMsg:test_assertNotStrContains() lu.assertErrorMsgEquals( 'Error, substring "abc" was found in string "abcdef"', lu.assertNotStrContains, 'abcdef', 'abc' ) lu.assertErrorMsgEquals( 'Error, substring "abc" was found in string "abcdef"', lu.assertNotStrContains, 'abcdef', 'abc', false ) lu.assertErrorMsgEquals( 'Error, regexp "..." was found in string "abcdef"', lu.assertNotStrContains, 'abcdef', '...', true) end function TestLuaUnitErrorMsg:test_assertNotStrIContains() lu.assertErrorMsgEquals( 'Error, substring "aBc" was found (case insensitively) in string "abcdef"', lu.assertNotStrIContains, 'abcdef', 'aBc' ) lu.assertErrorMsgEquals( 'Error, substring "abc" was found (case insensitively) in string "abcdef"', lu.assertNotStrIContains, 'abcdef', 'abc' ) end function TestLuaUnitErrorMsg:test_assertStrMatches() lu.assertErrorMsgEquals('Error, pattern "xxx" was not matched by string "abcdef"', lu.assertStrMatches, 'abcdef', 'xxx' ) end function TestLuaUnitErrorMsg:test_assertIsNumber() lu.assertErrorMsgEquals( 'Expected: a number value, actual: type string, value "abc"', lu.assertIsNumber, 'abc' ) lu.assertErrorMsgEquals( 'Expected: a number value, actual: type nil, value nil', lu.assertIsNumber, nil ) end function TestLuaUnitErrorMsg:test_assertIsString() lu.assertErrorMsgEquals( 'Expected: a string value, actual: type number, value 1.2', lu.assertIsString, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a string value, actual: type nil, value nil', lu.assertIsString, nil ) end function TestLuaUnitErrorMsg:test_assertIsTable() lu.assertErrorMsgEquals( 'Expected: a table value, actual: type number, value 1.2', lu.assertIsTable, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a table value, actual: type nil, value nil', lu.assertIsTable, nil ) end function TestLuaUnitErrorMsg:test_assertIsBoolean() lu.assertErrorMsgEquals( 'Expected: a boolean value, actual: type number, value 1.2', lu.assertIsBoolean, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a boolean value, actual: type nil, value nil', lu.assertIsBoolean, nil ) end function TestLuaUnitErrorMsg:test_assertIsFunction() lu.assertErrorMsgEquals( 'Expected: a function value, actual: type number, value 1.2', lu.assertIsFunction, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a function value, actual: type nil, value nil', lu.assertIsFunction, nil ) end function TestLuaUnitErrorMsg:test_assertIsCoroutine() lu.assertErrorMsgEquals( 'Expected: a thread value, actual: type number, value 1.2', lu.assertIsCoroutine, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a thread value, actual: type nil, value nil', lu.assertIsCoroutine, nil ) end function TestLuaUnitErrorMsg:test_assertIsUserdata() lu.assertErrorMsgEquals( 'Expected: a userdata value, actual: type number, value 1.2', lu.assertIsUserdata, 1.2 ) lu.assertErrorMsgEquals( 'Expected: a userdata value, actual: type nil, value nil', lu.assertIsUserdata, nil ) end function TestLuaUnitErrorMsg:test_assertIs() lu.assertErrorMsgEquals( 'Expected object and actual object are not the same\nExpected: 1, actual: 2', lu.assertIs, 2, 1 ) lu.ORDER_ACTUAL_EXPECTED = false lu.assertErrorMsgEquals( 'Expected object and actual object are not the same\nExpected: 2, actual: 1', lu.assertIs, 2, 1 ) end function TestLuaUnitErrorMsg:test_assertNotIs() local v = {1,2} lu.assertErrorMsgMatches( 'Expected object and actual object are the same object: {1, 2}', lu.assertNotIs, v, v ) end function TestLuaUnitErrorMsg:test_assertItemsEquals() lu.assertErrorMsgMatches('Contents of the tables are not identical:\nExpected: {one=2, two=3}\nActual: {1, 2}' , lu.assertItemsEquals, {1,2}, {one=2, two=3} ) end function TestLuaUnitErrorMsg:test_assertError() lu.assertErrorMsgEquals('Expected an error when calling function but no error generated' , lu.assertError, function( v ) local y = v+1 end, 3 ) end function TestLuaUnitErrorMsg:test_assertErrorMsg() lu.assertErrorMsgEquals('No error generated when calling function but expected error: "bla bla bla"' , lu.assertErrorMsgEquals, 'bla bla bla', function( v ) local y = v+1 end, 3 ) lu.assertErrorMsgEquals('No error generated when calling function but expected error containing: "bla bla bla"' , lu.assertErrorMsgContains, 'bla bla bla', function( v ) local y = v+1 end, 3 ) lu.assertErrorMsgEquals('No error generated when calling function but expected error matching: "bla bla bla"' , lu.assertErrorMsgMatches, 'bla bla bla', function( v ) local y = v+1 end, 3 ) lu.assertErrorMsgEquals('Exact error message expected: "bla bla bla"\nError message received: "toto xxx"\n' , lu.assertErrorMsgEquals, 'bla bla bla', function( v ) error('toto xxx',2) end, 3 ) lu.assertErrorMsgEquals('Error message does not contain: "bla bla bla"\nError message received: "toto xxx"\n' , lu.assertErrorMsgContains, 'bla bla bla', function( v ) error('toto xxx',2) end, 3 ) lu.assertErrorMsgEquals('Error message does not match: "bla bla bla"\nError message received: "toto xxx"\n' , lu.assertErrorMsgMatches, 'bla bla bla', function( v ) error('toto xxx',2) end, 3 ) end function TestLuaUnitErrorMsg:test_printTableWithRef() lu.PRINT_TABLE_REF_IN_ERROR_MSG = true lu.assertErrorMsgMatches( 'Received the not expected value: {1, 2}', lu.assertNotEquals, {1,2}, {1,2} ) -- trigger multiline prettystr lu.assertErrorMsgMatches( 'Received the not expected value: {1, 2, 3, 4}', lu.assertNotEquals, {1,2,3,4}, {1,2,3,4} ) lu.assertErrorMsgMatches( 'expected: false, actual: {}', lu.assertFalse, {}) local v = {1,2} lu.assertErrorMsgMatches( 'Expected object and actual object are the same object: {1, 2}', lu.assertNotIs, v, v ) lu.assertErrorMsgMatches('Contents of the tables are not identical:\nExpected: {one=2, two=3}\nActual: {1, 2}' , lu.assertItemsEquals, {1,2}, {one=2, two=3} ) lu.assertErrorMsgMatches( 'expected: {1, 2, 3}\nactual: {3, 2, 1}', lu.assertEquals, {3,2,1}, {1,2,3} ) -- trigger multiline prettystr lu.assertErrorMsgMatches( 'expected: {1, 2, 3, 4}\nactual: {3, 2, 1, 4}', lu.assertEquals, {3,2,1,4}, {1,2,3,4} ) lu.assertErrorMsgMatches( 'expected: {one=1, two=2}\nactual: {3, 2, 1}', lu.assertEquals, {3,2,1}, {one=1,two=2} ) end ------------------------------------------------------------------ -- -- Execution Tests -- ------------------------------------------------------------------ MyTestToto1 = {} --class function MyTestToto1:test1() table.insert( executedTests, "MyTestToto1:test1" ) end function MyTestToto1:testb() table.insert( executedTests, "MyTestToto1:testb" ) end function MyTestToto1:test3() table.insert( executedTests, "MyTestToto1:test3" ) end function MyTestToto1:testa() table.insert( executedTests, "MyTestToto1:testa" ) end function MyTestToto1:test2() table.insert( executedTests, "MyTestToto1:test2" ) end MyTestToto2 = {} --class function MyTestToto2:test1() table.insert( executedTests, "MyTestToto2:test1" ) end MyTestWithFailures = {} --class function MyTestWithFailures:testWithFailure1() lu.assertEquals(1, 2) end function MyTestWithFailures:testWithFailure2() lu.assertError( function() end ) end function MyTestWithFailures:testOk() end MyTestOk = {} --class function MyTestOk:testOk1() end function MyTestOk:testOk2() end function MyTestFunction() table.insert( executedTests, "MyTestFunction" ) end TestLuaUnitExecution = {} --class TestLuaUnitExecution.__class__ = 'TestLuaUnitExecution' function TestLuaUnitExecution:tearDown() executedTests = {} lu.LuaUnit.isTestName = lu.LuaUnit.isTestNameOld end function TestLuaUnitExecution:setUp() executedTests = {} lu.LuaUnit.isTestNameOld = lu.LuaUnit.isTestName lu.LuaUnit.isTestName = function( s ) return (string.sub(s,1,6) == 'MyTest') end end function TestLuaUnitExecution:test_collectTests() allTests = lu.LuaUnit.collectTests() lu.assertEquals( allTests, {"MyTestFunction", "MyTestOk", "MyTestToto1", "MyTestToto2","MyTestWithFailures"}) end function TestLuaUnitExecution:test_MethodsAreExecutedInRightOrder() local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuite( 'MyTestToto1' ) lu.assertEquals( #executedTests, 5 ) lu.assertEquals( executedTests[1], "MyTestToto1:test1" ) lu.assertEquals( executedTests[2], "MyTestToto1:test2" ) lu.assertEquals( executedTests[3], "MyTestToto1:test3" ) lu.assertEquals( executedTests[4], "MyTestToto1:testa" ) lu.assertEquals( executedTests[5], "MyTestToto1:testb" ) end function TestLuaUnitExecution:test_runSuiteByNames() -- note: this also test that names are executed in explicit order local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByNames( { 'MyTestToto2', 'MyTestToto1', 'MyTestFunction' } ) lu.assertEquals( #executedTests, 7 ) lu.assertEquals( executedTests[1], "MyTestToto2:test1" ) lu.assertEquals( executedTests[2], "MyTestToto1:test1" ) lu.assertEquals( executedTests[7], "MyTestFunction" ) end function TestLuaUnitExecution:testRunSomeTestByGlobalInstance( ) lu.assertEquals( #executedTests, 0 ) local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'Toto', MyTestToto1 } } ) lu.assertEquals( #executedTests, 5 ) lu.assertEquals( #runner.result.tests, 5 ) lu.assertEquals( runner.result.tests[1].testName, "Toto.test1" ) lu.assertEquals( runner.result.tests[5].testName, "Toto.testb" ) end function TestLuaUnitExecution:testRunSomeTestByLocalInstance( ) MyLocalTestToto1 = {} --class function MyLocalTestToto1:test1() table.insert( executedTests, "MyLocalTestToto1:test1" ) end MyLocalTestToto2 = {} --class function MyLocalTestToto2:test1() table.insert( executedTests, "MyLocalTestToto2:test1" ) end function MyLocalTestToto2:test2() table.insert( executedTests, "MyLocalTestToto2:test2" ) end function MyLocalTestFunction() table.insert( executedTests, "MyLocalTestFunction" ) end lu.assertEquals( #executedTests, 0 ) local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyLocalTestToto1', MyLocalTestToto1 }, { 'MyLocalTestToto2.test2', MyLocalTestToto2 }, { 'MyLocalTestFunction', MyLocalTestFunction }, } ) lu.assertEquals( #executedTests, 3 ) lu.assertEquals( executedTests[1], 'MyLocalTestToto1:test1') lu.assertEquals( executedTests[2], 'MyLocalTestToto2:test2') lu.assertEquals( executedTests[3], 'MyLocalTestFunction') end function TestLuaUnitExecution:testRunReturnsNumberOfFailures() local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) ret = runner:runSuite( 'MyTestWithFailures' ) lu.assertEquals(ret, 2) ret = runner:runSuite( 'MyTestToto1' ) lu.assertEquals(ret, 0) end function TestLuaUnitExecution:testTestCountAndFailCount() local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuite( 'MyTestWithFailures' ) lu.assertEquals( runner.result.testCount, 3) lu.assertEquals( runner.result.failureCount, 2) runner:runSuite( 'MyTestToto1' ) lu.assertEquals( runner.result.testCount, 5) lu.assertEquals( runner.result.failureCount, 0) end function TestLuaUnitExecution:testRunSetupAndTeardown() local myExecutedTests = {} local MyTestWithSetupTeardown = {} function MyTestWithSetupTeardown:setUp() table.insert( myExecutedTests, '1setUp' ) end function MyTestWithSetupTeardown:test1() table.insert( myExecutedTests, '1test1' ) end function MyTestWithSetupTeardown:test2() table.insert( myExecutedTests, '1test2' ) end function MyTestWithSetupTeardown:tearDown() table.insert( myExecutedTests, '1tearDown' ) end local MyTestWithSetupTeardown2 = {} function MyTestWithSetupTeardown2:setUp() table.insert( myExecutedTests, '2setUp' ) end function MyTestWithSetupTeardown2:test1() table.insert( myExecutedTests, '2test1' ) end function MyTestWithSetupTeardown2:tearDown() table.insert( myExecutedTests, '2tearDown' ) end local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupTeardown.test1', MyTestWithSetupTeardown } } ) lu.assertEquals( runner.result.failureCount, 0 ) lu.assertEquals( myExecutedTests[1], '1setUp' ) lu.assertEquals( myExecutedTests[2], '1test1') lu.assertEquals( myExecutedTests[3], '1tearDown') lu.assertEquals( #myExecutedTests, 3) myExecutedTests = {} runner:runSuiteByInstances( { { 'MyTestWithSetupTeardown', MyTestWithSetupTeardown }, { 'MyTestWithSetupTeardown2', MyTestWithSetupTeardown2 } } ) lu.assertEquals( runner.result.failureCount, 0 ) lu.assertEquals( myExecutedTests[1], '1setUp' ) lu.assertEquals( myExecutedTests[2], '1test1') lu.assertEquals( myExecutedTests[3], '1tearDown') lu.assertEquals( myExecutedTests[4], '1setUp' ) lu.assertEquals( myExecutedTests[5], '1test2') lu.assertEquals( myExecutedTests[6], '1tearDown') lu.assertEquals( myExecutedTests[7], '2setUp' ) lu.assertEquals( myExecutedTests[8], '2test1') lu.assertEquals( myExecutedTests[9], '2tearDown') lu.assertEquals( #myExecutedTests, 9) end function TestLuaUnitExecution:testWithSetupTeardownErrors1() local myExecutedTests = {} local MyTestWithSetupError = {} function MyTestWithSetupError:setUp() table.insert( myExecutedTests, 'setUp' ); lu.assertEquals( 'b', 'c') end function MyTestWithSetupError:test1() table.insert( myExecutedTests, 'test1' ) end function MyTestWithSetupError:tearDown() table.insert( myExecutedTests, 'tearDown' ) end local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupError', MyTestWithSetupError } } ) lu.assertEquals( runner.result.failureCount, 1 ) lu.assertEquals( runner.result.testCount, 1 ) lu.assertEquals( myExecutedTests[1], 'setUp' ) lu.assertEquals( myExecutedTests[2], 'tearDown') lu.assertEquals( #myExecutedTests, 2) end function TestLuaUnitExecution:testWithSetupTeardownErrors2() local myExecutedTests = {} local MyTestWithSetupError = {} function MyTestWithSetupError:setUp() table.insert( myExecutedTests, 'setUp' ) end function MyTestWithSetupError:test1() table.insert( myExecutedTests, 'test1' ) end function MyTestWithSetupError:tearDown() table.insert( myExecutedTests, 'tearDown' ); lu.assertEquals( 'b', 'c') end runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupError', MyTestWithSetupError } } ) lu.assertEquals( runner.result.failureCount, 1 ) lu.assertEquals( runner.result.testCount, 1 ) lu.assertEquals( myExecutedTests[1], 'setUp' ) lu.assertEquals( myExecutedTests[2], 'test1' ) lu.assertEquals( myExecutedTests[3], 'tearDown') lu.assertEquals( #myExecutedTests, 3) end function TestLuaUnitExecution:testWithSetupTeardownErrors3() local myExecutedTests = {} local MyTestWithSetupError = {} function MyTestWithSetupError:setUp() table.insert( myExecutedTests, 'setUp' ); lu.assertEquals( 'b', 'c') end function MyTestWithSetupError:test1() table.insert( myExecutedTests, 'test1' ) end function MyTestWithSetupError:tearDown() table.insert( myExecutedTests, 'tearDown' ); lu.assertEquals( 'b', 'c') end runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupError', MyTestWithSetupError } } ) lu.assertEquals( runner.result.failureCount, 1 ) lu.assertEquals( runner.result.testCount, 1 ) lu.assertEquals( myExecutedTests[1], 'setUp' ) lu.assertEquals( myExecutedTests[2], 'tearDown') lu.assertEquals( #myExecutedTests, 2) end function TestLuaUnitExecution:testWithSetupTeardownErrors4() local myExecutedTests = {} local MyTestWithSetupError = {} function MyTestWithSetupError:setUp() table.insert( myExecutedTests, 'setUp' ); lu.assertEquals( 'b', 'c') end function MyTestWithSetupError:test1() table.insert( myExecutedTests, 'test1' ); lu.assertEquals( 'b', 'c') end function MyTestWithSetupError:tearDown() table.insert( myExecutedTests, 'tearDown' ); lu.assertEquals( 'b', 'c') end runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupError', MyTestWithSetupError } } ) lu.assertEquals( runner.result.failureCount, 1 ) lu.assertEquals( runner.result.testCount, 1 ) lu.assertEquals( myExecutedTests[1], 'setUp' ) lu.assertEquals( myExecutedTests[2], 'tearDown') lu.assertEquals( #myExecutedTests, 2) end function TestLuaUnitExecution:testWithSetupTeardownErrors5() local myExecutedTests = {} local MyTestWithSetupError = {} function MyTestWithSetupError:setUp() table.insert( myExecutedTests, 'setUp' ) end function MyTestWithSetupError:test1() table.insert( myExecutedTests, 'test1' ); lu.assertEquals( 'b', 'c') end function MyTestWithSetupError:tearDown() table.insert( myExecutedTests, 'tearDown' ); lu.assertEquals( 'b', 'c') end runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByInstances( { { 'MyTestWithSetupError', MyTestWithSetupError } } ) lu.assertEquals( runner.result.failureCount, 1 ) lu.assertEquals( runner.result.testCount, 1 ) lu.assertEquals( myExecutedTests[1], 'setUp' ) lu.assertEquals( myExecutedTests[2], 'test1' ) lu.assertEquals( myExecutedTests[3], 'tearDown') lu.assertEquals( #myExecutedTests, 3) end function TestLuaUnitExecution:testOutputInterface() local runner = lu.LuaUnit:new() runner.outputType = Mock runner:runSuite( 'MyTestWithFailures', 'MyTestOk' ) m = runner.output lu.assertEquals( m.calls[1][1], 'startSuite' ) lu.assertEquals(#m.calls[1], 2 ) lu.assertEquals( m.calls[2][1], 'startClass' ) lu.assertEquals( m.calls[2][3], 'MyTestWithFailures' ) lu.assertEquals(#m.calls[2], 3 ) lu.assertEquals( m.calls[3][1], 'startTest' ) lu.assertEquals( m.calls[3][3], 'MyTestWithFailures.testOk' ) lu.assertEquals(#m.calls[3], 3 ) lu.assertEquals( m.calls[4][1], 'endTest' ) lu.assertEquals( m.calls[4][3], false ) lu.assertEquals(#m.calls[4], 3 ) lu.assertEquals( m.calls[5][1], 'startTest' ) lu.assertEquals( m.calls[5][3], 'MyTestWithFailures.testWithFailure1' ) lu.assertEquals(#m.calls[5], 3 ) lu.assertEquals( m.calls[6][1], 'addFailure' ) lu.assertEquals(#m.calls[6], 4 ) lu.assertEquals( m.calls[7][1], 'endTest' ) lu.assertEquals( m.calls[7][3], true ) lu.assertEquals(#m.calls[7], 3 ) lu.assertEquals( m.calls[8][1], 'startTest' ) lu.assertEquals( m.calls[8][3], 'MyTestWithFailures.testWithFailure2' ) lu.assertEquals(#m.calls[8], 3 ) lu.assertEquals( m.calls[9][1], 'addFailure' ) lu.assertEquals(#m.calls[9], 4 ) lu.assertEquals( m.calls[10][1], 'endTest' ) lu.assertEquals( m.calls[10][3], true ) lu.assertEquals(#m.calls[10], 3 ) lu.assertEquals( m.calls[11][1], 'endClass' ) lu.assertEquals(#m.calls[11], 2 ) lu.assertEquals( m.calls[12][1], 'startClass' ) lu.assertEquals( m.calls[12][3], 'MyTestOk' ) lu.assertEquals(#m.calls[12], 3 ) lu.assertEquals( m.calls[13][1], 'startTest' ) lu.assertEquals( m.calls[13][3], 'MyTestOk.testOk1' ) lu.assertEquals(#m.calls[13], 3 ) lu.assertEquals( m.calls[14][1], 'endTest' ) lu.assertEquals( m.calls[14][3], false ) lu.assertEquals(#m.calls[14], 3 ) lu.assertEquals( m.calls[15][1], 'startTest' ) lu.assertEquals( m.calls[15][3], 'MyTestOk.testOk2' ) lu.assertEquals(#m.calls[15], 3 ) lu.assertEquals( m.calls[16][1], 'endTest' ) lu.assertEquals( m.calls[16][3], false ) lu.assertEquals(#m.calls[16], 3 ) lu.assertEquals( m.calls[17][1], 'endClass' ) lu.assertEquals(#m.calls[17], 2 ) lu.assertEquals( m.calls[18][1], 'endSuite' ) lu.assertEquals(#m.calls[18], 2 ) lu.assertEquals( m.calls[19], nil ) end function TestLuaUnitExecution:test_filterWithPattern() runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuite('-p', 'Function', '-p', 'Toto.' ) lu.assertEquals( executedTests[1], "MyTestFunction" ) lu.assertEquals( executedTests[2], "MyTestToto1:test1" ) lu.assertEquals( executedTests[3], "MyTestToto1:test2" ) lu.assertEquals( executedTests[4], "MyTestToto1:test3" ) lu.assertEquals( executedTests[5], "MyTestToto1:testa" ) lu.assertEquals( executedTests[6], "MyTestToto1:testb" ) lu.assertEquals( executedTests[7], "MyTestToto2:test1" ) lu.assertEquals( #executedTests, 7) end ------------------------------------------------------------------ -- -- Results Tests -- ------------------------------------------------------------------ TestLuaUnitResults = {} -- class TestLuaUnitResults.__class__ = 'TestLuaUnitResults' function TestLuaUnitResults:tearDown() executedTests = {} lu.LuaUnit.isTestName = lu.LuaUnit.isTestNameOld end function TestLuaUnitResults:setUp() executedTests = {} lu.LuaUnit.isTestNameOld = lu.LuaUnit.isTestName lu.LuaUnit.isTestName = function( s ) return (string.sub(s,1,6) == 'MyTest') end end function TestLuaUnitResults:test_nodeStatus() es = lu.NodeStatus:new() lu.assertEquals( es.status, lu.NodeStatus.PASS ) lu.assertNil( es.msg ) lu.assertNil( es.stackTrace ) es:fail( 'msgToto', 'stackTraceToto' ) lu.assertEquals( es.status, lu.NodeStatus.FAIL ) lu.assertEquals( es.msg, 'msgToto' ) lu.assertEquals( es.stackTrace, 'stackTraceToto' ) es2 = lu.NodeStatus:new() lu.assertEquals( es2.status, lu.NodeStatus.PASS ) lu.assertNil( es2.msg ) lu.assertNil( es2.stackTrace ) es:pass() lu.assertEquals( es.status, lu.NodeStatus.PASS ) lu.assertNil( es.msg ) lu.assertNil( es.stackTrace ) end function TestLuaUnitResults:test_runSuiteOk() local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuiteByNames( { 'MyTestToto2', 'MyTestToto1', 'MyTestFunction' } ) lu.assertEquals( #runner.result.tests, 7 ) lu.assertEquals( #runner.result.failures, 0 ) lu.assertEquals( runner.result.tests[1].testName,"MyTestToto2.test1" ) lu.assertEquals( runner.result.tests[1].number, 1 ) lu.assertEquals( runner.result.tests[1].className, 'MyTestToto2' ) lu.assertEquals( runner.result.tests[1].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[2].testName,"MyTestToto1.test1" ) lu.assertEquals( runner.result.tests[2].number, 2 ) lu.assertEquals( runner.result.tests[2].className, 'MyTestToto1' ) lu.assertEquals( runner.result.tests[2].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[3].testName,"MyTestToto1.test2" ) lu.assertEquals( runner.result.tests[3].number, 3 ) lu.assertEquals( runner.result.tests[3].className, 'MyTestToto1' ) lu.assertEquals( runner.result.tests[3].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[4].testName,"MyTestToto1.test3" ) lu.assertEquals( runner.result.tests[4].number, 4 ) lu.assertEquals( runner.result.tests[4].className, 'MyTestToto1' ) lu.assertEquals( runner.result.tests[4].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[5].testName,"MyTestToto1.testa" ) lu.assertEquals( runner.result.tests[5].number, 5 ) lu.assertEquals( runner.result.tests[5].className, 'MyTestToto1' ) lu.assertEquals( runner.result.tests[5].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[6].testName,"MyTestToto1.testb" ) lu.assertEquals( runner.result.tests[6].number, 6 ) lu.assertEquals( runner.result.tests[6].className, 'MyTestToto1' ) lu.assertEquals( runner.result.tests[6].status, lu.NodeStatus.PASS ) lu.assertEquals( runner.result.tests[7].testName,"MyTestFunction" ) lu.assertEquals( runner.result.tests[7].number, 7) lu.assertEquals( runner.result.tests[7].className, '[TestFunctions]' ) lu.assertEquals( runner.result.tests[7].status, lu.NodeStatus.PASS ) end function TestLuaUnitResults:test_runSuiteWithFailures() local runner = lu.LuaUnit:new() runner:setOutputType( "NIL" ) runner:runSuite( 'MyTestWithFailures' ) lu.assertEquals( #runner.result.tests, 3 ) lu.assertEquals( #runner.result.failures, 2 ) lu.assertEquals( runner.result.tests[1].number, 1 ) lu.assertEquals( runner.result.tests[1].testName, "MyTestWithFailures.testOk" ) lu.assertEquals( runner.result.tests[1].className, 'MyTestWithFailures' ) lu.assertEquals( runner.result.tests[1].status, lu.NodeStatus.PASS ) lu.assertIsNumber( runner.result.tests[1].duration ) lu.assertIsNil( runner.result.tests[1].msg ) lu.assertIsNil( runner.result.tests[1].stackTrace ) lu.assertEquals( runner.result.tests[2].testName, 'MyTestWithFailures.testWithFailure1' ) lu.assertEquals( runner.result.tests[2].className, 'MyTestWithFailures' ) lu.assertEquals( runner.result.tests[2].status, lu.NodeStatus.FAIL ) lu.assertIsString( runner.result.tests[2].msg ) lu.assertIsString( runner.result.tests[2].stackTrace ) lu.assertEquals( runner.result.tests[3].testName, 'MyTestWithFailures.testWithFailure2' ) lu.assertEquals( runner.result.tests[3].className, 'MyTestWithFailures' ) lu.assertEquals( runner.result.tests[3].status, lu.NodeStatus.FAIL ) lu.assertIsString( runner.result.tests[3].msg ) lu.assertIsString( runner.result.tests[3].stackTrace ) lu.assertEquals( runner.result.failures[1].testName, 'MyTestWithFailures.testWithFailure1' ) lu.assertEquals( runner.result.failures[1].className, 'MyTestWithFailures' ) lu.assertEquals( runner.result.failures[1].status, lu.NodeStatus.FAIL ) lu.assertIsString( runner.result.failures[1].msg ) lu.assertIsString( runner.result.failures[1].stackTrace ) lu.assertEquals( runner.result.failures[2].testName, 'MyTestWithFailures.testWithFailure2' ) lu.assertEquals( runner.result.failures[2].className, 'MyTestWithFailures' ) lu.assertEquals( runner.result.failures[2].status, lu.NodeStatus.FAIL ) lu.assertIsString( runner.result.failures[2].msg ) lu.assertIsString( runner.result.failures[2].stackTrace ) end function TestLuaUnitResults:test_resultsWhileTestInProgress() local runner = lu.LuaUnit:new() local MyMocker = {} MyMocker.new = function() local t = Mock:new() t.startTest = function(self, testName ) if self.result.currentNode.number == 1 then lu.assertEquals( self.result.currentNode.number, 1 ) lu.assertEquals( self.result.currentNode.testName, 'MyTestWithFailures.testOk' ) lu.assertEquals( self.result.currentNode.className, 'MyTestWithFailures' ) lu.assertEquals( self.result.currentNode.status, lu.NodeStatus.PASS ) elseif self.result.currentNode.number == 2 then lu.assertEquals( self.result.currentNode.number, 2 ) lu.assertEquals( self.result.currentNode.testName, 'MyTestWithFailures.testWithFailure1' ) lu.assertEquals( self.result.currentNode.className, 'MyTestWithFailures' ) lu.assertEquals( self.result.currentNode.status, lu.NodeStatus.PASS ) end end t.endTest = function(self, status) if self.result.currentNode.number == 1 then lu.assertEquals( self.result.currentNode.status, lu.NodeStatus.PASS ) elseif self.result.currentNode.number == 2 then lu.assertEquals( self.result.currentNode.status, lu.NodeStatus.FAIL ) end end return t end runner.outputType = MyMocker runner:runSuite( 'MyTestWithFailures' ) m = runner.output lu.assertEquals( m.calls[1][1], 'startSuite' ) lu.assertEquals(#m.calls[1], 2 ) end -- To execute me , use: lua run_unit_tests.lua luaunit-3.1/test/test_with_xml.lua0000666000000000000000000000106612477651646015571 0ustar 00000000000000 lu = require('luaunit') TestFailuresWithXml = {} --class TestFailuresWithXml.__class__ = 'TestFailuresWithXml' function TestFailuresWithXml:test_failure_with_simple_xml() lu.assertEquals( 'ti"ti', 'got it' ) end function TestFailuresWithXml:test_failure_with_cdata_xml() lu.assertEquals( 'cdata does not like ]]>', 'got it' ) end function TestThatLastsALongTime() local start = os.clock() while os.clock() - start < 1.1 do end end lu.LuaUnit.verbosity = 2 os.exit( lu.LuaUnit.run() ) luaunit-3.1/test/unitTestseNilDefault.txt0000666000000000000000000000000012477651656017040 0ustar 00000000000000luaunit-3.1/test/unitTestsTapDefault.txt0000666000000000000000000001432612477651656016715 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.015 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsTapQuiet.txt0000666000000000000000000001432612477651656016420 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.016 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsTextDefault.txt0000666000000000000000000000022412477651663017103 0ustar 00000000000000............................................................................................................. Ran 109 tests in 0.023 seconds OK luaunit-3.1/test/unitTestsTextQuiet.txt0000666000000000000000000000022412477651663016606 0ustar 00000000000000............................................................................................................. Ran 109 tests in 0.030 seconds OK luaunit-3.1/test/unitTestsTextVerbose.txt0000666000000000000000000001411312477651663017126 0ustar 00000000000000Started on 02/01/15 00:00:56 TestLuaUnitAssertions.test_assertAlmostEquals ... Ok TestLuaUnitAssertions.test_assertEquals ... Ok TestLuaUnitAssertions.test_assertFalse ... Ok TestLuaUnitAssertions.test_assertIs ... Ok TestLuaUnitAssertions.test_assertIsBoolean ... Ok TestLuaUnitAssertions.test_assertIsCoroutine ... Ok TestLuaUnitAssertions.test_assertIsFunction ... Ok TestLuaUnitAssertions.test_assertIsNil ... Ok TestLuaUnitAssertions.test_assertIsNumber ... Ok TestLuaUnitAssertions.test_assertIsString ... Ok TestLuaUnitAssertions.test_assertIsTable ... Ok TestLuaUnitAssertions.test_assertIsUserdata ... Ok TestLuaUnitAssertions.test_assertItemsEquals ... Ok TestLuaUnitAssertions.test_assertNil ... Ok TestLuaUnitAssertions.test_assertNotAlmostEquals ... Ok TestLuaUnitAssertions.test_assertNotEquals ... Ok TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ... Ok TestLuaUnitAssertions.test_assertNotIs ... Ok TestLuaUnitAssertions.test_assertNotNil ... Ok TestLuaUnitAssertions.test_assertNotStrContains ... Ok TestLuaUnitAssertions.test_assertNotStrIContains ... Ok TestLuaUnitAssertions.test_assertStrContains ... Ok TestLuaUnitAssertions.test_assertStrIContains ... Ok TestLuaUnitAssertions.test_assertStrMatches ... Ok TestLuaUnitAssertions.test_assertTableAdditions ... Ok TestLuaUnitAssertions.test_assertTableLev2 ... Ok TestLuaUnitAssertions.test_assertTableList ... Ok TestLuaUnitAssertions.test_assertTableNil ... Ok TestLuaUnitAssertions.test_assertTableNilFront ... Ok TestLuaUnitAssertions.test_assertTableNum ... Ok TestLuaUnitAssertions.test_assertTableStr ... Ok TestLuaUnitAssertions.test_assertTrue ... Ok TestLuaUnitAssertionsError.test_assertError ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgContains ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgEquals ... Ok TestLuaUnitAssertionsError.test_assertErrorMsgMatches ... Ok TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertError ... Ok TestLuaUnitErrorMsg.test_assertErrorMsg ... Ok TestLuaUnitErrorMsg.test_assertIs ... Ok TestLuaUnitErrorMsg.test_assertIsBoolean ... Ok TestLuaUnitErrorMsg.test_assertIsCoroutine ... Ok TestLuaUnitErrorMsg.test_assertIsFunction ... Ok TestLuaUnitErrorMsg.test_assertIsNumber ... Ok TestLuaUnitErrorMsg.test_assertIsString ... Ok TestLuaUnitErrorMsg.test_assertIsTable ... Ok TestLuaUnitErrorMsg.test_assertIsUserdata ... Ok TestLuaUnitErrorMsg.test_assertItemsEquals ... Ok TestLuaUnitErrorMsg.test_assertNil ... Ok TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertNotEqualsMsg ... Ok TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ... Ok TestLuaUnitErrorMsg.test_assertNotIs ... Ok TestLuaUnitErrorMsg.test_assertNotStrContains ... Ok TestLuaUnitErrorMsg.test_assertNotStrIContains ... Ok TestLuaUnitErrorMsg.test_assertStrContains ... Ok TestLuaUnitErrorMsg.test_assertStrIContains ... Ok TestLuaUnitErrorMsg.test_assertStrMatches ... Ok TestLuaUnitErrorMsg.test_assertTrueFalse ... Ok TestLuaUnitErrorMsg.test_printTableWithRef ... Ok TestLuaUnitExecution.testOutputInterface ... Ok TestLuaUnitExecution.testRunReturnsNumberOfFailures ... Ok TestLuaUnitExecution.testRunSetupAndTeardown ... Ok TestLuaUnitExecution.testRunSomeTestByGlobalInstance ... Ok TestLuaUnitExecution.testRunSomeTestByLocalInstance ... Ok TestLuaUnitExecution.testTestCountAndFailCount ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors1 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors2 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors3 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors4 ... Ok TestLuaUnitExecution.testWithSetupTeardownErrors5 ... Ok TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ... Ok TestLuaUnitExecution.test_collectTests ... Ok TestLuaUnitExecution.test_filterWithPattern ... Ok TestLuaUnitExecution.test_runSuiteByNames ... Ok TestLuaUnitResults.test_nodeStatus ... Ok TestLuaUnitResults.test_resultsWhileTestInProgress ... Ok TestLuaUnitResults.test_runSuiteOk ... Ok TestLuaUnitResults.test_runSuiteWithFailures ... Ok TestLuaUnitUtilities.test_IsClassMethod ... Ok TestLuaUnitUtilities.test_IsFunction ... Ok TestLuaUnitUtilities.test_applyPatternFilter ... Ok TestLuaUnitUtilities.test_expandClasses ... Ok TestLuaUnitUtilities.test_expandOneClass ... Ok TestLuaUnitUtilities.test_genSortedIndex ... Ok TestLuaUnitUtilities.test_hasNewline ... Ok TestLuaUnitUtilities.test_includePattern ... Ok TestLuaUnitUtilities.test_isTestName ... Ok TestLuaUnitUtilities.test_parseCmdLine ... Ok TestLuaUnitUtilities.test_prefixString ... Ok TestLuaUnitUtilities.test_prettstrTableRecursion ... Ok TestLuaUnitUtilities.test_prettystr ... Ok TestLuaUnitUtilities.test_prettystr_adv_tables ... Ok TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ... Ok TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ... Ok TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ... Ok TestLuaUnitUtilities.test_splitClassMethod ... Ok TestLuaUnitUtilities.test_strMatch ... Ok TestLuaUnitUtilities.test_strSplit3CharDelim ... Ok TestLuaUnitUtilities.test_strSplitOnFailure ... Ok TestLuaUnitUtilities.test_strSplitOneCharDelim ... Ok TestLuaUnitUtilities.test_stripStackTrace ... Ok TestLuaUnitUtilities.test_table_keytostring ... Ok TestLuaUnitUtilities.test_xmlCDataEscape ... Ok TestLuaUnitUtilities.test_xmlEscape ... Ok TestMock.testMock ... Ok ========================================================= Ran 109 tests in 0.031 seconds OK luaunit-3.1/test/unitTestsVerbose.txt0000666000000000000000000001432612477651656016271 0ustar 000000000000001..109 # Started on 02/01/15 00:00:55 # Starting class: TestLuaUnitAssertions ok 1 TestLuaUnitAssertions.test_assertAlmostEquals ok 2 TestLuaUnitAssertions.test_assertEquals ok 3 TestLuaUnitAssertions.test_assertFalse ok 4 TestLuaUnitAssertions.test_assertIs ok 5 TestLuaUnitAssertions.test_assertIsBoolean ok 6 TestLuaUnitAssertions.test_assertIsCoroutine ok 7 TestLuaUnitAssertions.test_assertIsFunction ok 8 TestLuaUnitAssertions.test_assertIsNil ok 9 TestLuaUnitAssertions.test_assertIsNumber ok 10 TestLuaUnitAssertions.test_assertIsString ok 11 TestLuaUnitAssertions.test_assertIsTable ok 12 TestLuaUnitAssertions.test_assertIsUserdata ok 13 TestLuaUnitAssertions.test_assertItemsEquals ok 14 TestLuaUnitAssertions.test_assertNil ok 15 TestLuaUnitAssertions.test_assertNotAlmostEquals ok 16 TestLuaUnitAssertions.test_assertNotEquals ok 17 TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 ok 18 TestLuaUnitAssertions.test_assertNotIs ok 19 TestLuaUnitAssertions.test_assertNotNil ok 20 TestLuaUnitAssertions.test_assertNotStrContains ok 21 TestLuaUnitAssertions.test_assertNotStrIContains ok 22 TestLuaUnitAssertions.test_assertStrContains ok 23 TestLuaUnitAssertions.test_assertStrIContains ok 24 TestLuaUnitAssertions.test_assertStrMatches ok 25 TestLuaUnitAssertions.test_assertTableAdditions ok 26 TestLuaUnitAssertions.test_assertTableLev2 ok 27 TestLuaUnitAssertions.test_assertTableList ok 28 TestLuaUnitAssertions.test_assertTableNil ok 29 TestLuaUnitAssertions.test_assertTableNilFront ok 30 TestLuaUnitAssertions.test_assertTableNum ok 31 TestLuaUnitAssertions.test_assertTableStr ok 32 TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError ok 33 TestLuaUnitAssertionsError.test_assertError ok 34 TestLuaUnitAssertionsError.test_assertErrorMsgContains ok 35 TestLuaUnitAssertionsError.test_assertErrorMsgEquals ok 36 TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg ok 37 TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg ok 38 TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg ok 39 TestLuaUnitErrorMsg.test_assertEqualsMsg ok 40 TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg ok 41 TestLuaUnitErrorMsg.test_assertError ok 42 TestLuaUnitErrorMsg.test_assertErrorMsg ok 43 TestLuaUnitErrorMsg.test_assertIs ok 44 TestLuaUnitErrorMsg.test_assertIsBoolean ok 45 TestLuaUnitErrorMsg.test_assertIsCoroutine ok 46 TestLuaUnitErrorMsg.test_assertIsFunction ok 47 TestLuaUnitErrorMsg.test_assertIsNumber ok 48 TestLuaUnitErrorMsg.test_assertIsString ok 49 TestLuaUnitErrorMsg.test_assertIsTable ok 50 TestLuaUnitErrorMsg.test_assertIsUserdata ok 51 TestLuaUnitErrorMsg.test_assertItemsEquals ok 52 TestLuaUnitErrorMsg.test_assertNil ok 53 TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg ok 54 TestLuaUnitErrorMsg.test_assertNotEqualsMsg ok 55 TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg ok 56 TestLuaUnitErrorMsg.test_assertNotIs ok 57 TestLuaUnitErrorMsg.test_assertNotStrContains ok 58 TestLuaUnitErrorMsg.test_assertNotStrIContains ok 59 TestLuaUnitErrorMsg.test_assertStrContains ok 60 TestLuaUnitErrorMsg.test_assertStrIContains ok 61 TestLuaUnitErrorMsg.test_assertStrMatches ok 62 TestLuaUnitErrorMsg.test_assertTrueFalse ok 63 TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution ok 64 TestLuaUnitExecution.testOutputInterface ok 65 TestLuaUnitExecution.testRunReturnsNumberOfFailures ok 66 TestLuaUnitExecution.testRunSetupAndTeardown ok 67 TestLuaUnitExecution.testRunSomeTestByGlobalInstance ok 68 TestLuaUnitExecution.testRunSomeTestByLocalInstance ok 69 TestLuaUnitExecution.testTestCountAndFailCount ok 70 TestLuaUnitExecution.testWithSetupTeardownErrors1 ok 71 TestLuaUnitExecution.testWithSetupTeardownErrors2 ok 72 TestLuaUnitExecution.testWithSetupTeardownErrors3 ok 73 TestLuaUnitExecution.testWithSetupTeardownErrors4 ok 74 TestLuaUnitExecution.testWithSetupTeardownErrors5 ok 75 TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder ok 76 TestLuaUnitExecution.test_collectTests ok 77 TestLuaUnitExecution.test_filterWithPattern ok 78 TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults ok 79 TestLuaUnitResults.test_nodeStatus ok 80 TestLuaUnitResults.test_resultsWhileTestInProgress ok 81 TestLuaUnitResults.test_runSuiteOk ok 82 TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities ok 83 TestLuaUnitUtilities.test_IsClassMethod ok 84 TestLuaUnitUtilities.test_IsFunction ok 85 TestLuaUnitUtilities.test_applyPatternFilter ok 86 TestLuaUnitUtilities.test_expandClasses ok 87 TestLuaUnitUtilities.test_expandOneClass ok 88 TestLuaUnitUtilities.test_genSortedIndex ok 89 TestLuaUnitUtilities.test_hasNewline ok 90 TestLuaUnitUtilities.test_includePattern ok 91 TestLuaUnitUtilities.test_isTestName ok 92 TestLuaUnitUtilities.test_parseCmdLine ok 93 TestLuaUnitUtilities.test_prefixString ok 94 TestLuaUnitUtilities.test_prettstrTableRecursion ok 95 TestLuaUnitUtilities.test_prettystr ok 96 TestLuaUnitUtilities.test_prettystr_adv_tables ok 97 TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues ok 98 TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables ok 99 TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable ok 100 TestLuaUnitUtilities.test_splitClassMethod ok 101 TestLuaUnitUtilities.test_strMatch ok 102 TestLuaUnitUtilities.test_strSplit3CharDelim ok 103 TestLuaUnitUtilities.test_strSplitOnFailure ok 104 TestLuaUnitUtilities.test_strSplitOneCharDelim ok 105 TestLuaUnitUtilities.test_stripStackTrace ok 106 TestLuaUnitUtilities.test_table_keytostring ok 107 TestLuaUnitUtilities.test_xmlCDataEscape ok 108 TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock ok 109 TestMock.testMock # Ran 109 tests in 0.016 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsXmlDefault.txt0000666000000000000000000001577212477651663016735 0ustar 00000000000000# XML output to test/ref/unitTestsXmlDefault.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.042 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsXmlDefault.xml0000666000000000000000000003617712477651663016720 0ustar 00000000000000 luaunit-3.1/test/unitTestsXmllintDefault.xml0000666000000000000000000000004712477651664017573 0ustar 00000000000000test/unitTestsXmlDefault.xml validates luaunit-3.1/test/unitTestsXmllintQuiet.xml0000666000000000000000000000004512477651664017274 0ustar 00000000000000test/unitTestsXmlQuiet.xml validates luaunit-3.1/test/unitTestsXmllintVerbose.xml0000666000000000000000000000004712477651664017614 0ustar 00000000000000test/unitTestsXmlVerbose.xml validates luaunit-3.1/test/unitTestsXmlQuiet.txt0000666000000000000000000001577012477651664016437 0ustar 00000000000000# XML output to test/ref/unitTestsXmlQuiet.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.031 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsXmlQuiet.xml0000666000000000000000000003617712477651664016424 0ustar 00000000000000 luaunit-3.1/test/unitTestsXmlVerbose.txt0000666000000000000000000001577212477651664016757 0ustar 00000000000000# XML output to test/ref/unitTestsXmlVerbose.xml # Started on 03/10/15 21:06:33 # Starting class: TestLuaUnitAssertions # Starting test: TestLuaUnitAssertions.test_assertAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertEquals # Starting test: TestLuaUnitAssertions.test_assertFalse # Starting test: TestLuaUnitAssertions.test_assertIs # Starting test: TestLuaUnitAssertions.test_assertIsBoolean # Starting test: TestLuaUnitAssertions.test_assertIsCoroutine # Starting test: TestLuaUnitAssertions.test_assertIsFunction # Starting test: TestLuaUnitAssertions.test_assertIsNil # Starting test: TestLuaUnitAssertions.test_assertIsNumber # Starting test: TestLuaUnitAssertions.test_assertIsString # Starting test: TestLuaUnitAssertions.test_assertIsTable # Starting test: TestLuaUnitAssertions.test_assertIsUserdata # Starting test: TestLuaUnitAssertions.test_assertItemsEquals # Starting test: TestLuaUnitAssertions.test_assertNil # Starting test: TestLuaUnitAssertions.test_assertNotAlmostEquals # Starting test: TestLuaUnitAssertions.test_assertNotEquals # Starting test: TestLuaUnitAssertions.test_assertNotEqualsDifferentTypes2 # Starting test: TestLuaUnitAssertions.test_assertNotIs # Starting test: TestLuaUnitAssertions.test_assertNotNil # Starting test: TestLuaUnitAssertions.test_assertNotStrContains # Starting test: TestLuaUnitAssertions.test_assertNotStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrContains # Starting test: TestLuaUnitAssertions.test_assertStrIContains # Starting test: TestLuaUnitAssertions.test_assertStrMatches # Starting test: TestLuaUnitAssertions.test_assertTableAdditions # Starting test: TestLuaUnitAssertions.test_assertTableLev2 # Starting test: TestLuaUnitAssertions.test_assertTableList # Starting test: TestLuaUnitAssertions.test_assertTableNil # Starting test: TestLuaUnitAssertions.test_assertTableNilFront # Starting test: TestLuaUnitAssertions.test_assertTableNum # Starting test: TestLuaUnitAssertions.test_assertTableStr # Starting test: TestLuaUnitAssertions.test_assertTrue # Starting class: TestLuaUnitAssertionsError # Starting test: TestLuaUnitAssertionsError.test_assertError # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgContains # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgEquals # Starting test: TestLuaUnitAssertionsError.test_assertErrorMsgMatches # Starting class: TestLuaUnitErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertAlmostEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertError # Starting test: TestLuaUnitErrorMsg.test_assertErrorMsg # Starting test: TestLuaUnitErrorMsg.test_assertIs # Starting test: TestLuaUnitErrorMsg.test_assertIsBoolean # Starting test: TestLuaUnitErrorMsg.test_assertIsCoroutine # Starting test: TestLuaUnitErrorMsg.test_assertIsFunction # Starting test: TestLuaUnitErrorMsg.test_assertIsNumber # Starting test: TestLuaUnitErrorMsg.test_assertIsString # Starting test: TestLuaUnitErrorMsg.test_assertIsTable # Starting test: TestLuaUnitErrorMsg.test_assertIsUserdata # Starting test: TestLuaUnitErrorMsg.test_assertItemsEquals # Starting test: TestLuaUnitErrorMsg.test_assertNil # Starting test: TestLuaUnitErrorMsg.test_assertNotAlmostEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotEqualsOrderReversedMsg # Starting test: TestLuaUnitErrorMsg.test_assertNotIs # Starting test: TestLuaUnitErrorMsg.test_assertNotStrContains # Starting test: TestLuaUnitErrorMsg.test_assertNotStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrContains # Starting test: TestLuaUnitErrorMsg.test_assertStrIContains # Starting test: TestLuaUnitErrorMsg.test_assertStrMatches # Starting test: TestLuaUnitErrorMsg.test_assertTrueFalse # Starting test: TestLuaUnitErrorMsg.test_printTableWithRef # Starting class: TestLuaUnitExecution # Starting test: TestLuaUnitExecution.testOutputInterface # Starting test: TestLuaUnitExecution.testRunReturnsNumberOfFailures # Starting test: TestLuaUnitExecution.testRunSetupAndTeardown # Starting test: TestLuaUnitExecution.testRunSomeTestByGlobalInstance # Starting test: TestLuaUnitExecution.testRunSomeTestByLocalInstance # Starting test: TestLuaUnitExecution.testTestCountAndFailCount # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors1 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors2 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors3 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors4 # Starting test: TestLuaUnitExecution.testWithSetupTeardownErrors5 # Starting test: TestLuaUnitExecution.test_MethodsAreExecutedInRightOrder # Starting test: TestLuaUnitExecution.test_collectTests # Starting test: TestLuaUnitExecution.test_filterWithPattern # Starting test: TestLuaUnitExecution.test_runSuiteByNames # Starting class: TestLuaUnitResults # Starting test: TestLuaUnitResults.test_nodeStatus # Starting test: TestLuaUnitResults.test_resultsWhileTestInProgress # Starting test: TestLuaUnitResults.test_runSuiteOk # Starting test: TestLuaUnitResults.test_runSuiteWithFailures # Starting class: TestLuaUnitUtilities # Starting test: TestLuaUnitUtilities.test_IsClassMethod # Starting test: TestLuaUnitUtilities.test_IsFunction # Starting test: TestLuaUnitUtilities.test_applyPatternFilter # Starting test: TestLuaUnitUtilities.test_expandClasses # Starting test: TestLuaUnitUtilities.test_expandOneClass # Starting test: TestLuaUnitUtilities.test_genSortedIndex # Starting test: TestLuaUnitUtilities.test_hasNewline # Starting test: TestLuaUnitUtilities.test_includePattern # Starting test: TestLuaUnitUtilities.test_isTestName # Starting test: TestLuaUnitUtilities.test_parseCmdLine # Starting test: TestLuaUnitUtilities.test_prefixString # Starting test: TestLuaUnitUtilities.test_prettstrTableRecursion # Starting test: TestLuaUnitUtilities.test_prettystr # Starting test: TestLuaUnitUtilities.test_prettystr_adv_tables # Starting test: TestLuaUnitUtilities.test_sortedNextReturnsSortedKeyValues # Starting test: TestLuaUnitUtilities.test_sortedNextWorksOnTwoTables # Starting test: TestLuaUnitUtilities.test_sortedNextWorksTwiceOnTable # Starting test: TestLuaUnitUtilities.test_splitClassMethod # Starting test: TestLuaUnitUtilities.test_strMatch # Starting test: TestLuaUnitUtilities.test_strSplit3CharDelim # Starting test: TestLuaUnitUtilities.test_strSplitOnFailure # Starting test: TestLuaUnitUtilities.test_strSplitOneCharDelim # Starting test: TestLuaUnitUtilities.test_stripStackTrace # Starting test: TestLuaUnitUtilities.test_table_keytostring # Starting test: TestLuaUnitUtilities.test_xmlCDataEscape # Starting test: TestLuaUnitUtilities.test_xmlEscape # Starting class: TestMock # Starting test: TestMock.testMock # Ran 109 tests in 0.030 seconds, 109 successes, 0 failures luaunit-3.1/test/unitTestsXmlVerbose.xml0000666000000000000000000003617712477651664016742 0ustar 00000000000000 luaunit-3.1/TODO.txt0000666000000000000000000000625112477651646012524 0ustar 00000000000000TODO v3.1: ============ - mention that general error are correctly handled by luaunit as failures TODO Future: ============ - detect if a functions creates new global variables. - validate output with ignored tests (0 failures or some failures) - report test duration everywhere - allow to skip tests - make a difference between errors and failures - randomized testing - provide a luarock package. See: https://rocks.moonscript.org/modules/rjpcomputing/luaunit - compatibility with LuaUnit v2.0 of rjbcomputing - coloured output - global setup / teardown - class setup / teardown - add date and duration to tap output - better error messages for table assertions: + expected length of X, got Y + keys differing in table 1 and 2 - XML: report system information Nice to have: ============ - lua 5.3 ? Need to wait for support by travis-CI - stack unwrapping like in py.test Done since 3.0: =============== x check documentation link glitch to TAP x doc: report how to handle global space pollution/restriction x doc: adapt all examples to new way of requireing luaunit x less global space pollution x doc: move description of table printing to an annex x validate well-formed XML with a DTD x validate test output (TAP, ...) with functional tests x test failures, verify that output is correct x improve testresult: contain the list of tests, with status of each test x strip luaunit stack more intelligently: exclude content of luaunit x mention mailing-list in README.md x mention version in documentation x mention mailing-list x mention the new global variable config for displaying table content x fix display of tables with recursive references x improve display of nested tables in error messages x improve display of multiline strings in error messages x Junit XML Ouptut: x test and fix xml escaping x validate xml with apache and jenkins schemas + xml format: - add proper xml formatting header - report number of failures within element - report duration - add properties describe the environment Done: ============ x add other types of output x assert with matching of the error message x finish user documentation x switch version 3.0 x add assertMatch for strings x document --name x improve junit xml output (one file, choice of filename) x display number of non selected tests x assertIs with all types x mention one file distribution x improve TAP output: pre-calculate test numbers, display test summary as comment x test error messages of assertStrMatches and all error functions x assertNil + assertNotNil x readthedocs integration x add travis-ci badges to README x filter by pattern x support --version x support --help x replace methodInstance with real test name in reports x better error messages for wrong command line option, or wrong output type x control verbosity and output type with command line x display time to run all tests x move all assertions together x better error display of assertIsXXX functions x add assertContains for strings x add assertIsNumber, assertIsXXX x table assertions x sequence asserts x compatibilty tests with several version of lua x add assertNotEquals