214 constructor(
string type);
216 constructor(
string type,
string subType);
261 constructor(
auto value) ;
274 constructor(hash<auto> value) ;
314 string m_exceptionDetail;
339 string m_exceptionRegexp;
343 constructor(
string exceptionType,
string exceptionRegexp) ;
356 constructor(
string exceptionType,
string exceptionSubstring) ;
398 static list<auto> getStackList(list stack,
bool ok = False);
400 static string getPos(hash<auto> ex);
402 string getTimestamp();
422 int getAssertionCount();
425 int getAssertionOkCount();
428 int getAssertionSkipCount();
447 const PLAINQUIET = 0;
451 const OUT_TYPES = ...;
454 const RESULT_TYPE_DESCRIPTION = ...;
463 list<hash<auto>> m_results = ();
497 const TEST_SUCCESS = 0;
498 const TEST_FAILURE = 1;
499 const TEST_ERROR = 2;
500 const TEST_SKIPPED = 3;
503 printOption(
string left,
string right,
int offset =
OffsetColumn);
518 processOptions(reference<list<string>> p_argv);
528 constructor(
string name,
string version, reference<list<string>> p_argv, hash<auto> opts =
Opts);
542 init(
string name,
string version, reference<list<string>> p_argv, hash<auto> opts =
Opts);
547 callPrinterFunction(
string type, *softlist<auto> args);
552 printHeader() { callPrinterFunction(
"header"); } printSummary() { callPrinterFunction(
"summary"); } printTestReport(hash testcase) { callPrinterFunction(
"testreport", testcase); }
553 printPlaintextHeader();
555 printPlaintextSummary();
557 printPlaintextOneTest(hash<auto> testcase);
619 constructor(
string name,
string version, reference<list<string>> p_argv, *hash<auto> opts) ;
623 constructor(
string name,
string version, *list<auto> p_argv, *hash<auto> opts) ;
666 string escapeSpecialChars(
string str);
668 string escapeSpecialChars2(
string str);
670 bool diffInSpecialCharsOnly(
string a,
string b);
675 string shorten(
auto value);
677 compare(
auto v1,
auto v2, reference<list<string>> out,
string path, *
bool soft_comparisons);
679 compareHashes(hash h1, hash h2, reference<list<string>> out,
string path =
'', *
bool soft_comparisons);
681 compareLists(list<auto> l1, list<auto> l2, reference<list<string>> out,
string path =
'', *
bool soft_comparisons);
797 assertEq(
auto expected,
auto actual, *
string name);
859 assertGt(
auto expected,
auto actual, *
string name);
883 assertGe(
auto expected,
auto actual, *
string name);
907 assertLt(
auto expected,
auto actual, *
string name);
931 assertLe(
auto expected,
auto actual, *
string name);
971 assertThrows(
string expectedErr, *
string expectedDesc, *hash<auto> arg, code theCode, *softlist<auto> args, *
string name);
985 assertThrows(
string expectedErr, *
string expectedDesc, code theCode, *softlist<auto> args, *
string name);
998 assertThrows(
string expectedErr, code theCode, *softlist<auto> args, *
string name);
1044 auto testAssertion(
string name, code condition, *softlist<auto> args,
int expectedResultValue);
1055 auto testAssertion(
string name, code condition, *softlist<auto> args,
float expectedResultValue);
1066 auto testAssertion(
string name, code condition, *softlist<auto> args, number expectedResultValue);
1077 auto testAssertion(
string name, code condition, *softlist<auto> args,
bool expectedResultValue);
1088 auto testAssertion(
string name, code condition, *softlist<auto> args,
string expectedResultValue);
1099 auto testAssertion(
string name, code condition, *softlist<auto> args, date expectedResultValue);
1110 auto testAssertion(
string name, code condition, *softlist<auto> args, binary expectedResultValue);
1121 auto testAssertion(
string name, code condition, *softlist<auto> args, hash<auto> expectedResultValue);
1132 auto testAssertion(
string name, code condition, *softlist<auto> args, list<auto> expectedResultValue);
1229 constructor(
string name,
string version, reference<list<string>> p_argv, *hash<auto> opts) ;
1233 constructor(
string name,
string version, *list<auto> p_argv, *hash<auto> opts) ;
1285class QUnit::DependencyInjectedTestRunner :
public QUnit::Test {
1295 injectClass(
string name, *
string new_name) {} injectFunction(
string name, *
string new_name) {} injectUserModule(
string module, *code custom_setup, *code custom_parsing) {}
1296 constructor(
string name,
string version, reference<list<string>> p_argv, *hash<auto> opts) ;
1299 constructor(
string name,
string version, *list<auto> p_argv, *hash<auto> opts) ;
An abstract class representing test result interface.
Definition QUnit.qm.dox.h:208
A class representing a test with injected dependencies.
Definition QUnit.qm.dox.h:1210
hash< string, Program > modules
a hash of user modules subject to injections
Definition QUnit.qm.dox.h:1221
abstract performInjectionsImpl()
implement this in subclasses to perform all injections
abstract string getScriptPathImpl()
implement this in subclasses to perform all injections
reloadSelf()
override to supply the source to the current test in case it's not available on the filesystem
static bool instantiated
a flag to ensure that injections are not performed recursively
Definition QUnit.qm.dox.h:1224
Program createInjectedProgram(string path)
creates the Program object subject to injection
performCommonInjections(Program p)
override this method to perform injections common to the primary child logic container and all user m...
performInjections()
performs injections
createProgram()
creates the main child Program object subject to injection
int main()
creates the injected program, reloads the source into it, and executes the test
setReloadedParseOptions(Program p, string file_data)
override to optionally set parse options on the reloaded source
injectFunction(string func_name, *string new_name)
injects a function
int getParseOptions()
override this method to affect the parse options that Program objects subject to injection will get
injectClass(string class_name, *string new_name)
injects a class
injectUserModule(string module, *code custom_setup, *code custom_parsing)
performs all injections into the given user module
string getScriptPath()
Returns the path to the script to be tested.
string testedFile
the name of the script to run with injections
Definition QUnit.qm.dox.h:1215
Program child
the child Program object subject to injections
Definition QUnit.qm.dox.h:1218
constructor(string name, string version, *list< auto > p_argv, *hash< auto > opts)
creates the injected test object
constructor(string name, string version, reference< list< string > > p_argv, *hash< auto > opts)
creates the injected test object
reloadAndCommitProgram()
reloads the test source and finalizes and commits the injected child Program object
Class containing the configuration for a test case.
Definition QUnit.qm.dox.h:363
checkException(QUnit::Test test, hash< auto > e)
handles exceptions raised while running the TestCase
auto saved_tc
any saved test case
Definition QUnit.qm.dox.h:386
*list< auto > m_args
arguments to the above callable object
Definition QUnit.qm.dox.h:374
code m_code
the body of the test case
Definition QUnit.qm.dox.h:371
string m_name
the name of the test case
Definition QUnit.qm.dox.h:368
string getName()
returns the test case name
int num_asserts_ok
number of successful assertions in current test case
Definition QUnit.qm.dox.h:380
int num_asserts
number of assertions in current test case
Definition QUnit.qm.dox.h:377
rename(string n_name)
renames the test case
constructor(string name, code code, *softlist< auto > args)
creates the TestCase object from the given arguments
run(QUnit::Test test)
runs the TestCase
int num_asserts_skip
number of skipped assertions in current test case
Definition QUnit.qm.dox.h:383
Base class representing a simple test, implements an implicit main() function and all utility functio...
Definition QUnit.qm.dox.h:579
const QUC_NRE
negative regex comparitor
Definition QUnit.qm.dox.h:607
assertLe(auto expected, auto actual, *string name)
Tests that a value is less than or equal to an expected value with hard comparisons (types may not di...
int main()
Run the whole suite, report results.
const QUC_LE
greater than or equals comparitor
Definition QUnit.qm.dox.h:603
fail(*string msg)
Fails the test unconditionally.
assertGt(auto expected, auto actual, *string name)
Tests that a value is greater than an expected value with hard comparisons (types may not differ)
bool regexpMatches(string s, string regexp)
Compare a string for match against a regexp.
assertNumberEq(number expected, number actual, number epsilon=DEFAULT_EPSILON, *string name)
Tests a number value for equality to an expected value with an allowed error.
auto testAssertion(string name, code condition, *softlist< auto > args, float expectedResultValue)
Tests for a single assertion for a call returning a floating-point value and returns the value genera...
tearDown()
Prototype function for cleaning up test environemnt. It will be called after each test has executed.
Definition QUnit.qm.dox.h:636
assertionOk(*string name)
process an ok assertion
auto testAssertionValue(*string name, number actual, number expected, number epsilon=DEFAULT_EPSILON)
Tests a value for equality to an expected value of number type.
static bool comparePartialHash(hash< auto > expects, auto value)
Returns True if the keys given in the first hash match those in the second hash.
const QUC_NEQ
inequality comparitor
Definition QUnit.qm.dox.h:595
auto testAssertion(string name, code condition, *softlist< auto > args, number expectedResultValue)
Tests for a single assertion for a call returning an arbitrary-precision numeric value and returns th...
globalSetUp()
global setup; will be called once before tests are run
Definition QUnit.qm.dox.h:627
auto testAssertion(string name, code condition, *softlist< auto > args, binary expectedResultValue)
Tests for a single assertion for a call returning a binary value and returns the value generated.
auto testAssertion(string name, code condition, *softlist< auto > args, list< auto > expectedResultValue)
Tests for a single assertion for a call returning a list value and returns the value generated.
const DEFAULT_EPSILON
default epsilon for number/float comparison
Definition QUnit.qm.dox.h:614
setUp()
Prototype function for setting up test environment. It will be called for each test individually.
Definition QUnit.qm.dox.h:633
constructor(string name, string version, reference< list< string > > p_argv, *hash< auto > opts)
creates the object and sets the name of the test
auto testAssertion(string name, code condition, *softlist< auto > args, int expectedResultValue)
Tests for a single assertion for a call returning an integer value and returns the value generated.
auto testAssertion(string name, code condition, *softlist< auto > args, bool expectedResultValue)
Tests for a single assertion for a call returning a boolean value and returns the value generated.
testSkip(string reason)
Skips a given test, eg. because it may be missing some dependencies.
assertThrows(string expectedErr, *string expectedDesc, code theCode, *softlist< auto > args, *string name)
Tests that a piece of code throws an exception with given description.
assertSkip(*string name)
Skips assertion on purpose.
constructor(string name, string version, *list< auto > p_argv, *hash< auto > opts)
creates the object and sets the name of the test
globalTearDown()
global tear down; will be called once after all tests are run
Definition QUnit.qm.dox.h:630
assertNRegex(string regex_pattern, string actual, *string name)
Tests that a test value does not pass a regular expression match.
TestCase getTestCase(string meth)
returns the current test case
bool equals(auto a, auto b)
Compare two values for equality.
auto testAssertion(string name, code condition, *softlist< auto > args, string expectedResultValue)
Tests for a single assertion for a call returning a string value and returns the value generated.
const QUC_LT
greater than comparitor
Definition QUnit.qm.dox.h:601
bool notEquals(auto a, auto b)
Compare two values for inequality.
const QUC_GT
greater than comparitor
Definition QUnit.qm.dox.h:597
auto testAssertionValue(*string name, float actual, float expected, float epsilon=DEFAULT_EPSILON)
Tests a value for equality to an expected value of float type.
auto testAssertion(string name, code condition, *softlist< auto > args, QUnit::AbstractTestResult expectedResult=new QUnit::TestResultSuccess())
Tests for a single assertion and returns the value generated.
bool equalsIterated(AbstractIterator a, AbstractIterator b)
Compare two iterables, item by item, for equality of each index.
assertFloatEq(float expected, float actual, float epsilon=DEFAULT_EPSILON, *string name)
Tests a float value for equality to an expected value with an allowed error.
assertGtSoft(auto expected, auto actual, *string name)
Tests that a value is greater than an expected value with soft comparisons (types may differ)
assertLt(auto expected, auto actual, *string name)
Tests that a value is less than an expected value with hard comparisons (types may not differ)
assertEq(auto expected, auto actual, *string name)
Tests a value for equality to an expected value with hard comparisons (types and values must be ident...
assertGe(auto expected, auto actual, *string name)
Tests that a value is greater than or equal to an expected value with hard comparisons (types may not...
assertThrows(string expectedErr, code theCode, *softlist< auto > args, *string name)
Tests that a piece of code throws an exception.
auto testAssertion(string name, code condition, *softlist< auto > args, hash< auto > expectedResultValue)
Tests for a single assertion for a call returning a hash value and returns the value generated.
assertGeSoft(auto expected, auto actual, *string name)
Tests that a value is greater than or equal to than an expected value with soft comparisons (types ma...
*string getEnv(string key, *string def)
facade for the system environment variables
assertThrows(string expectedErr, *string expectedDesc, *hash< auto > arg, code theCode, *softlist< auto > args, *string name)
Tests that a piece of code throws an exception with given description and exception arg keys.
assertNothing(auto actual, *string name)
Tests for no value.
assertTrue(auto actual, *string name)
Tests a boolean value.
const QUC_GE
greater than or equals comparitor
Definition QUnit.qm.dox.h:599
const QUC_Map
comparitor info
Definition QUnit.qm.dox.h:610
addTestCase(QUnit::TestCase tc)
adds a test case to run
list< TestCase > testCases()
list of test cases
assertEqSoft(auto expected, auto actual, *string name)
Tests a value for equality to an expected value with soft comparisons (types may differ)
assertNeq(auto expected, auto actual, *string name)
Tests a value for inequality to an expected value with hard comparisons (types and values must be ide...
auto testAssertion(string name, code condition, *softlist< auto > args, date expectedResultValue)
Tests for a single assertion for a call returning a date value and returns the value generated.
assertLeSoft(auto expected, auto actual, *string name)
Tests that a value is less than or equal to than an expected value with soft comparisons (types may d...
assertNeqSoft(auto expected, auto actual, *string name)
Tests a value for inequality to an expected value with soft comparisons (types may differ)
string printUnexpectedData(auto exp, auto act, *bool neg, *bool soft_comparisons, *string comparitor)
Helper function for printing out human-readable comparison of two values.
static string getAssertionName(*string name)
returns the assertion name for display purposes
const QUC_EQ
equality comparitor
Definition QUnit.qm.dox.h:593
assertLtSoft(auto expected, auto actual, *string name)
Tests that a value is less than an expected value with soft comparisons (types may differ)
testNullAssertion(string name, code condition, *softlist< auto > args)
Tests for a single assertion for a call returning no value (for example, to ensure that the call does...
const QUC_RE
regex comparitor
Definition QUnit.qm.dox.h:605
auto testAssertionValue(*string name, auto actual, auto expected)
Tests a value for equality to an expected value.
assertFalse(auto actual, *string name)
Tests a boolean value.
addTestCase(string name, code call, *softlist< auto > args)
adds a test case to run
assertRegex(string regex_pattern, string actual, *string name)
Tests that a test value passes a regular expression match.
Base class for collecting test results and reporting.
Definition QUnit.qm.dox.h:443
int num_asserts_skip
total number of skipped assertions in script
Definition QUnit.qm.dox.h:486
const OffsetColumn
the default column offset for printing options used in printOption() and usageIntern()
Definition QUnit.qm.dox.h:458
int errors()
returns the number of errors encountered during test execution
int num_asserts
total number of assertions in script
Definition QUnit.qm.dox.h:480
hash< string, hash< string, code > > m_printMethods
A map of print methods, categorised into three types: header, summary, testreport.
Definition QUnit.qm.dox.h:461
constructor(string name, string version, reference< list< string > > p_argv, hash< auto > opts=Opts)
creates the object from the arguments
const Opts
default options for Qore::GetOpt::constructor()
Definition QUnit.qm.dox.h:494
string m_name
test case name
Definition QUnit.qm.dox.h:475
constructor(string name, string version, *list< auto > p_argv, hash< auto > opts=Opts)
creates the object from the arguments
int testCount()
returns the total number of test results
string m_version
test case version
Definition QUnit.qm.dox.h:477
*list< auto > new_argv
new ARGV for languages that don't support lvalue references
Definition QUnit.qm.dox.h:489
addTestResult(TestCase tc, int success, *string error, *string pos, *string detail)
adds a test result
hash< auto > m_options
the result of parsing command-line options with Qore::GetOpt::parse2()
Definition QUnit.qm.dox.h:472
int skipped()
returns the number of tests skipped
int num_asserts_ok
total number of successful assertions in script
Definition QUnit.qm.dox.h:483
init(string name, string version, reference< list< string > > p_argv, hash< auto > opts=Opts)
common constructor code
Class representing Exception of a particular type with a particular detail message.
Definition QUnit.qm.dox.h:310
constructor(string exceptionType, string exceptionDetail)
creates the object from the exception arguments
bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing Exception of a particular type and matching regexp for detail.
Definition QUnit.qm.dox.h:335
bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing Exception of a particular type and substring for detail.
Definition QUnit.qm.dox.h:353
Class representing Exception of a particular type.
Definition QUnit.qm.dox.h:283
constructor(string exceptionType)
creates the object from the exception arguments
string m_exceptionType
corresponds to the "err" key of ExceptionInfo (the first value of a throw statement)
Definition QUnit.qm.dox.h:287
bool equals(QUnit::AbstractTestResult r)
Equality operator.
string toString()
returns a string describing the exception type
constructor(string exceptionType, string subType)
private constructor for subclasses
Class representing test function failure, both unspecific and with detail.
Definition QUnit.qm.dox.h:235
constructor()
Instantiate an unspecific failure, no detail.
constructor(string s)
Instantiate an annotated failure, string detail.
bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing a partial match of a hash value. Common keys have to be identical.
Definition QUnit.qm.dox.h:271
Class representing boolean True.
Definition QUnit.qm.dox.h:222
bool equals(QUnit::AbstractTestResult r)
Equality operator.
Class representing any non-boolean value.
Definition QUnit.qm.dox.h:258
bool equals(QUnit::AbstractTestResult r)
Equality operator.
the main namespace for all public definitions in the QUnit module
Definition QUnit.qm.dox.h:205