Changed rhs expression capture from universal ref to const ref.
- addresses #1027
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index 6aaa7ed..939d0d8 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -1003,6 +1003,6 @@
"{?}" == "1"
===============================================================================
-test cases: 179 | 128 passed | 47 failed | 4 failed as expected
-assertions: 884 | 767 passed | 96 failed | 21 failed as expected
+test cases: 180 | 129 passed | 47 failed | 4 failed as expected
+assertions: 886 | 769 passed | 96 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index 10b6fc3..1d64df2 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -739,6 +739,24 @@
true
-------------------------------------------------------------------------------
+Bitfields can be captured (#1027)
+-------------------------------------------------------------------------------
+TrickyTests.cpp:<line number>
+...............................................................................
+
+TrickyTests.cpp:<line number>:
+PASSED:
+ REQUIRE( y.v == 0 )
+with expansion:
+ 0 == 0
+
+TrickyTests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == y.v )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
Capture and info messages
Capture should stringify like assertions
-------------------------------------------------------------------------------
@@ -7490,6 +7508,6 @@
PASSED:
===============================================================================
-test cases: 179 | 126 passed | 49 failed | 4 failed as expected
-assertions: 883 | 763 passed | 99 failed | 21 failed as expected
+test cases: 180 | 127 passed | 49 failed | 4 failed as expected
+assertions: 885 | 765 passed | 99 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index b306b39..508b920 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
- <testsuite name="<exe-name>" errors="15" failures="85" tests="884" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="15" failures="85" tests="886" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
@@ -109,6 +109,7 @@
<testcase classname="<exe-name>.global" name="Assertions then sections/A section" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another section" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Bitfields can be captured (#1027)" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}"/>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index da12285..72b7c1b 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -750,6 +750,25 @@
</Section>
<OverallResult success="true"/>
</TestCase>
+ <TestCase name="Bitfields can be captured (#1027)" filename="projects/<exe-name>/TrickyTests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
+ <Original>
+ y.v == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
+ <Original>
+ 0 == y.v
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
<TestCase name="Capture and info messages" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
<Section name="Capture should stringify like assertions" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
<Info>
@@ -8268,7 +8287,7 @@
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="763" failures="100" expectedFailures="21"/>
+ <OverallResults successes="765" failures="100" expectedFailures="21"/>
</Group>
- <OverallResults successes="763" failures="99" expectedFailures="21"/>
+ <OverallResults successes="765" failures="99" expectedFailures="21"/>
</Catch>
diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp
index 78f7052..820d2fb 100644
--- a/projects/SelfTest/TrickyTests.cpp
+++ b/projects/SelfTest/TrickyTests.cpp
@@ -168,7 +168,7 @@
{
struct Object
{
- operator unsigned int() {return 0xc0000000;}
+ operator unsigned int() const {return 0xc0000000;}
};
///////////////////////////////////////////////////////////////////////////////
@@ -436,3 +436,12 @@
TestClass test;
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
}
+
+TEST_CASE( "Bitfields can be captured (#1027)" ) {
+ struct Y {
+ uint32_t v : 1;
+ };
+ Y y{ 0 };
+ REQUIRE( y.v == 0 );
+ REQUIRE( 0 == y.v );
+}