Skip to content

Commit

Permalink
refs #3172 updated QUnit::Test::testSkip() to format the reason string (
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnich authored and sejvlond committed Dec 10, 2018
1 parent d986b91 commit 8d878fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Expand Up @@ -143,6 +143,10 @@
- <a href="../../modules/PgsqlSqlUtil/html/index.html">PgsqlSqlUtil</a> module changes:
- Added support for serializing and deserializing \c AbstractTable objects
(<a href="https://github.com/qorelanguage/qore/issues/2663">issue 2663</a>)
- <a href="../../modules/QUnit/html/index.html">QUnit</a> module changes:
- updated @ref QUnit::Test::testSkip() "Test::testSkip()" to use the reason argument a format string with
@ref Qore::vsprintf() "vsprintf()"
(<a href="https://github.com/qorelanguage/qore/issues/3172">issue 3172</a>)
- <a href="../../modules/RestHandler/html/index.html">RestHandler</a> module changes:
- Updated to support alternative URI paths for actions so that an "action=xxx" argument is not needed; instead
the action can be added to the end of the URI path so that \c "PUT path/xxx" can be used instead of
Expand Down
5 changes: 5 additions & 0 deletions examples/test/qlib/QUnit/tests.qtest
Expand Up @@ -38,6 +38,7 @@ public class EmptyTest inherits QUnit::Test {

public class QUnitTest inherits QUnit::Test {
constructor() : Test("QUnitTest", "1.0") {
addTestCase("issue 3172", \issue3172());
addTestCase("Dependency injection tests", \testInjectedClass());
addTestCase("Test empty test", \testEmptyTest());
addTestCase("misc test", \testMisc());
Expand All @@ -50,6 +51,10 @@ public class QUnitTest inherits QUnit::Test {
return True;
}

issue3172() {
assertThrows("TEST-SKIPPED-EXCEPTION", "fmt: 1", \testSkip(), ("fmt: %d", 1));
}

testMisc() {
assertNeqSoft(1, 2);
assertNeq(1, "1");
Expand Down
8 changes: 6 additions & 2 deletions qlib/QUnit.qm
Expand Up @@ -131,6 +131,9 @@ public class MyTestClass inherits QUnit::DependencyInjectedTest {
@section unittest_relnotes Release Notes

@subsection qunit_v0_4 Version 0.4
- updated @ref QUnit::Test::testSkip() "Test::testSkip()" to use the reason argument a format string with
@ref Qore::vsprintf() "vsprintf()"
(<a href="https://github.com/qorelanguage/qore/issues/3172">issue 3172</a>)
- fixed error reporting with type errors with number values
(<a href="https://github.com/qorelanguage/qore/issues/2984">issue 2984</a>)

Expand Down Expand Up @@ -1900,10 +1903,11 @@ fail("Unexpected code executed");

#! Skips a given test, eg. because it may be missing some dependencies.
/**
* @param reason The reason for the test skip
* @param reason The reason for the test skip; used as the format argument with @ref Qore::vsprintf() "vsprintf()"
* with any remaining arguments
*/
public testSkip(string reason) {
throw "TEST-SKIPPED-EXCEPTION", reason;
throw "TEST-SKIPPED-EXCEPTION", vsprintf(reason, argv);
}

######### Test conditions passable to test assertions
Expand Down

0 comments on commit 8d878fa

Please sign in to comment.