mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Stop accepting non-const comparison operators
A) non-const comparison operators should not exist and should not be encouraged B) The logic breaks comparing function pointers certain way C) It was inconsistent anyway, as it only applied to `==` and `!=` Closes #925
This commit is contained in:
@@ -156,6 +156,18 @@ with expansion:
|
||||
with message:
|
||||
dummy := 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#925: comparing function pointer to function address failed to compile
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( utility::synchronizing_callback != test.testMethod_uponComplete_arg )
|
||||
with expansion:
|
||||
1 != 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#961 -- Dynamically created sections should all be reported
|
||||
Looped section 0
|
||||
@@ -1215,18 +1227,6 @@ ExceptionTests.cpp:<line number>: FAILED:
|
||||
due to unexpected exception with message:
|
||||
custom std exception
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Demonstrate that a non-const == is not used
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( t == 1u )
|
||||
with expansion:
|
||||
{?} == 1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
EndsWith string matcher
|
||||
-------------------------------------------------------------------------------
|
||||
|
@@ -156,6 +156,18 @@ with expansion:
|
||||
with message:
|
||||
dummy := 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#925: comparing function pointer to function address failed to compile
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( utility::synchronizing_callback != test.testMethod_uponComplete_arg )
|
||||
with expansion:
|
||||
1 != 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#961 -- Dynamically created sections should all be reported
|
||||
Looped section 0
|
||||
@@ -237,6 +249,6 @@ ConditionTests.cpp:<line number>: FAILED:
|
||||
CHECK_FALSE( true )
|
||||
|
||||
===============================================================================
|
||||
test cases: 9 | 6 passed | 1 failed | 2 failed as expected
|
||||
assertions: 26 | 19 passed | 4 failed | 3 failed as expected
|
||||
test cases: 10 | 7 passed | 1 failed | 2 failed as expected
|
||||
assertions: 27 | 20 passed | 4 failed | 3 failed as expected
|
||||
|
||||
|
@@ -27,6 +27,7 @@ MiscTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="#872" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#925: comparing function pointer to function address failed to compile" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 0" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 1" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 2" time="{duration}"/>
|
||||
@@ -143,7 +144,6 @@ custom std exception
|
||||
ExceptionTests.cpp:<line number>
|
||||
</error>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Demonstrate that a non-const == is not used" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}">
|
||||
<failure message=""this string contains 'abc' as a substring" ends with: "this"" type="CHECK_THAT">
|
||||
MatchersTests.cpp:<line number>
|
||||
|
@@ -169,6 +169,17 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#925: comparing function pointer to function address failed to compile" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
utility::synchronizing_callback != test.testMethod_uponComplete_arg
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 != 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="Looped section 0" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
@@ -1336,17 +1347,6 @@
|
||||
</Exception>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Demonstrate that a non-const == is not used" tags="[Tricky]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
t == 1u
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
|
Reference in New Issue
Block a user