Git Product home page Git Product logo

Comments (4)

claremacrae avatar claremacrae commented on July 20, 2024

Things we found when experimenting with this today:

  • CppUTest executes test from the end of the file, in reverse order
  • As soon as an exception is thrown in any source file, execution in that file halts

I wonder if this long discussion on a merged CppUTest PR provides any hints on how to work around this: cpputest/cpputest#1550

from approvaltests.cpp.

claremacrae avatar claremacrae commented on July 20, 2024

I wonder if this long discussion on a merged CppUTest PR provides any hints on how to work around this: cpputest/cpputest#1550

Yes, it did. Adding either of these two command-line arguments when running the tests makes both test failures be shown:

-e               - do not rethrow unexpected exceptions on failure
-ci              - continuous integration mode (equivalent to -e)

Confirmed with this change:

git diff
diff --git a/Makefile b/Makefile
index 86536c0..fd89508 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ clean :
        git clean -fx
 
 test: ExampleTestAndApprovalTest
-       ./ExampleTestAndApprovalTest
+       ./ExampleTestAndApprovalTest -e
 
 exampleonly: OnlyExampleTest
        ./OnlyExampleTest

The console output is then:

gitpod /workspace/approvals-cpp-exception (main) $ make test
./ExampleTestAndApprovalTest -e

./ExampleTestAndApprovalTest.cc:31: error: Failure in TEST(TestGroup, ApprovalTestsTest)
        Unexpected exception of type 'ApprovalTests::ApprovalMismatchException' was thrown: Failed Approval: 
Received does not match approved 
Received : "./ExampleTestAndApprovalTest.TestGroup.ApprovalTestsTest.received.txt" 
Approved : "./ExampleTestAndApprovalTest.TestGroup.ApprovalTestsTest.approved.txt"

.
./ExampleTestAndApprovalTest.cc:28: error: Failure in TEST(TestGroup, ExampleBasedTest)
        expected <a>
        but was  <b>
        difference starts at position 0 at: <          b         >
                                                       ^

.
Errors (2 failures, 2 tests, 2 ran, 1 checks, 0 ignored, 0 filtered out, 3 ms)

make: *** [Makefile:24: test] Error 2
gitpod /workspace/approvals-cpp-exception (main) $ 

from approvaltests.cpp.

claremacrae avatar claremacrae commented on July 20, 2024

We should probably add this to the documentation on the Approval Tests/CppUTest integration.

from approvaltests.cpp.

nitsanavni avatar nitsanavni commented on July 20, 2024

super!

thanks so much for taking the time!

from approvaltests.cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.