Add JSON reporter (#2706)

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:
Beartama
2023-11-14 23:52:15 +02:00
committed by GitHub
parent 2c68a0d05f
commit 7bf136b501
29 changed files with 2484 additions and 21 deletions

View File

@@ -87,6 +87,7 @@ set(TEST_SOURCES
${SELF_TEST_DIR}/IntrospectiveTests/FloatingPoint.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/GeneratorsImpl.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/InternalBenchmark.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/Json.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/Parse.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/RandomNumberGeneration.tests.cpp
@@ -642,7 +643,8 @@ foreach (reporterName # "Automake" - the simple .trs format does not support any
"SonarQube"
"TAP"
# "TeamCity" - does not seem to support test suite-level metadata/comments
"XML")
"XML"
"JSON")
add_test(NAME "Reporters:Filters:${reporterName}"
COMMAND
@@ -652,6 +654,8 @@ foreach (reporterName # "Automake" - the simple .trs format does not support any
# Different regex for these two reporters, because the commas end up xml-escaped
if (reporterName MATCHES "JUnit|XML")
set(testCaseNameFormat "&quot;CaseInsensitiveLess is case insensitive&quot;")
elseif(reporterName MATCHES "JSON")
set(testCaseNameFormat "\\\\\"CaseInsensitiveLess is case insensitive\\\\\"")
else()
set(testCaseNameFormat "\"CaseInsensitiveLess is case insensitive\"")
endif()

View File

@@ -170,6 +170,7 @@ Nor would this
:test-result: XFAIL Incomplete AssertionHandler
:test-result: XFAIL Inequality checks that should fail
:test-result: PASS Inequality checks that should succeed
:test-result: PASS JsonWriter
:test-result: PASS Lambdas in assertions
:test-result: PASS Less-than inequalities with different epsilons
:test-result: PASS ManuallyRegistered

View File

@@ -168,6 +168,7 @@
:test-result: XFAIL Incomplete AssertionHandler
:test-result: XFAIL Inequality checks that should fail
:test-result: PASS Inequality checks that should succeed
:test-result: PASS JsonWriter
:test-result: PASS Lambdas in assertions
:test-result: PASS Less-than inequalities with different epsilons
:test-result: PASS ManuallyRegistered

View File

@@ -979,6 +979,83 @@ Condition.tests.cpp:<line number>: passed: data.str_hello != "goodbye" for: "hel
Condition.tests.cpp:<line number>: passed: data.str_hello != "hell" for: "hello" != "hell"
Condition.tests.cpp:<line number>: passed: data.str_hello != "hello1" for: "hello" != "hello1"
Condition.tests.cpp:<line number>: passed: data.str_hello.size() != 6 for: 5 != 6
Json.tests.cpp:<line number>: passed: stream.str() == "" for: "" == ""
Json.tests.cpp:<line number>: passed: stream.str() == "{\n}" for: "{
}"
==
"{
}"
Json.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) for: "{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [
1,
2
]
}" )
Json.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) for: "{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
Json.tests.cpp:<line number>: passed: stream.str() == "[\n]" for: "[
]"
==
"[
]"
Json.tests.cpp:<line number>: passed: stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" for: "[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
Json.tests.cpp:<line number>: passed: stream.str() == "{\n}" for: "{
}"
==
"{
}"
Json.tests.cpp:<line number>: passed: stream.str() == "[\n]" for: "[
]"
==
"[
]"
Json.tests.cpp:<line number>: passed: stream.str() == "\"custom\"" for: ""custom"" == ""custom""
Json.tests.cpp:<line number>: passed: stream.str() == "\"\\\"\"" for: ""\""" == ""\"""
Compilation.tests.cpp:<line number>: passed: []() { return true; }() for: true
Approx.tests.cpp:<line number>: passed: d <= Approx( 1.24 ) for: 1.23 <= Approx( 1.24 )
Approx.tests.cpp:<line number>: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( 1.23 )
@@ -1343,6 +1420,60 @@ Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fa
" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: console'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag" with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fake reporter"s) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter" with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?>
All available tags:
1 [fakeTag]
@@ -2544,7 +2675,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected
test cases: 414 | 309 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2246 | 2065 passed | 146 failed | 35 failed as expected

View File

@@ -977,6 +977,83 @@ Condition.tests.cpp:<line number>: passed: data.str_hello != "goodbye" for: "hel
Condition.tests.cpp:<line number>: passed: data.str_hello != "hell" for: "hello" != "hell"
Condition.tests.cpp:<line number>: passed: data.str_hello != "hello1" for: "hello" != "hello1"
Condition.tests.cpp:<line number>: passed: data.str_hello.size() != 6 for: 5 != 6
Json.tests.cpp:<line number>: passed: stream.str() == "" for: "" == ""
Json.tests.cpp:<line number>: passed: stream.str() == "{\n}" for: "{
}"
==
"{
}"
Json.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) for: "{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [
1,
2
]
}" )
Json.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) for: "{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
Json.tests.cpp:<line number>: passed: stream.str() == "[\n]" for: "[
]"
==
"[
]"
Json.tests.cpp:<line number>: passed: stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" for: "[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
Json.tests.cpp:<line number>: passed: stream.str() == "{\n}" for: "{
}"
==
"{
}"
Json.tests.cpp:<line number>: passed: stream.str() == "[\n]" for: "[
]"
==
"[
]"
Json.tests.cpp:<line number>: passed: stream.str() == "\"custom\"" for: ""custom"" == ""custom""
Json.tests.cpp:<line number>: passed: stream.str() == "\"\\\"\"" for: ""\""" == ""\"""
Compilation.tests.cpp:<line number>: passed: []() { return true; }() for: true
Approx.tests.cpp:<line number>: passed: d <= Approx( 1.24 ) for: 1.23 <= Approx( 1.24 )
Approx.tests.cpp:<line number>: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( 1.23 )
@@ -1341,6 +1418,60 @@ Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fa
" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: console'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag" with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fake reporter"s) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter" with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?>
All available tags:
1 [fakeTag]
@@ -2533,7 +2664,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected
test cases: 414 | 309 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2246 | 2065 passed | 146 failed | 35 failed as expected

View File

@@ -1588,6 +1588,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 413 | 322 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2213 | 2049 passed | 129 failed | 35 failed as expected
test cases: 414 | 323 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2229 | 2065 passed | 129 failed | 35 failed as expected

View File

@@ -7258,6 +7258,195 @@ Condition.tests.cpp:<line number>: PASSED:
with expansion:
5 != 6
-------------------------------------------------------------------------------
JsonWriter
Newly constructed JsonWriter does nothing
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "" )
with expansion:
"" == ""
-------------------------------------------------------------------------------
JsonWriter
Calling writeObject will create an empty pair of braces
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "{\n}" )
with expansion:
"{
}"
==
"{
}"
-------------------------------------------------------------------------------
JsonWriter
Calling writeObject with key will create an object to write the value
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) )
with expansion:
"{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains:
""true": true," and contains: ""false": false," and contains: ""string":
"this is a string"," and contains: ""array": [
1,
2
]
}" )
-------------------------------------------------------------------------------
JsonWriter
nesting objects
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) )
with expansion:
"{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
-------------------------------------------------------------------------------
JsonWriter
Calling writeArray will create an empty pair of braces
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n]" )
with expansion:
"[
]"
==
"[
]"
-------------------------------------------------------------------------------
JsonWriter
Calling writeArray creates array to write the values to
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" )
with expansion:
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
-------------------------------------------------------------------------------
JsonWriter
Moved from JsonObjectWriter shall not insert superfluous brace
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "{\n}" )
with expansion:
"{
}"
==
"{
}"
-------------------------------------------------------------------------------
JsonWriter
Moved from JsonArrayWriter shall not insert superfluous bracket
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n]" )
with expansion:
"[
]"
==
"[
]"
-------------------------------------------------------------------------------
JsonWriter
Custom class shall be quoted
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "\"custom\"" )
with expansion:
""custom"" == ""custom""
-------------------------------------------------------------------------------
JsonWriter
String with a quote shall be espaced
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "\"\\\"\"" )
with expansion:
""\""" == ""\"""
-------------------------------------------------------------------------------
Lambdas in assertions
-------------------------------------------------------------------------------
@@ -9756,6 +9945,129 @@ Reporter's write listings to provided stream
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists tags
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag"
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists reporters
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter"
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists tests
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" )
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
@@ -18283,6 +18595,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected
test cases: 414 | 309 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2246 | 2065 passed | 146 failed | 35 failed as expected

View File

@@ -7256,6 +7256,195 @@ Condition.tests.cpp:<line number>: PASSED:
with expansion:
5 != 6
-------------------------------------------------------------------------------
JsonWriter
Newly constructed JsonWriter does nothing
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "" )
with expansion:
"" == ""
-------------------------------------------------------------------------------
JsonWriter
Calling writeObject will create an empty pair of braces
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "{\n}" )
with expansion:
"{
}"
==
"{
}"
-------------------------------------------------------------------------------
JsonWriter
Calling writeObject with key will create an object to write the value
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) )
with expansion:
"{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains:
""true": true," and contains: ""false": false," and contains: ""string":
"this is a string"," and contains: ""array": [
1,
2
]
}" )
-------------------------------------------------------------------------------
JsonWriter
nesting objects
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) )
with expansion:
"{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
-------------------------------------------------------------------------------
JsonWriter
Calling writeArray will create an empty pair of braces
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n]" )
with expansion:
"[
]"
==
"[
]"
-------------------------------------------------------------------------------
JsonWriter
Calling writeArray creates array to write the values to
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" )
with expansion:
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
-------------------------------------------------------------------------------
JsonWriter
Moved from JsonObjectWriter shall not insert superfluous brace
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "{\n}" )
with expansion:
"{
}"
==
"{
}"
-------------------------------------------------------------------------------
JsonWriter
Moved from JsonArrayWriter shall not insert superfluous bracket
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "[\n]" )
with expansion:
"[
]"
==
"[
]"
-------------------------------------------------------------------------------
JsonWriter
Custom class shall be quoted
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "\"custom\"" )
with expansion:
""custom"" == ""custom""
-------------------------------------------------------------------------------
JsonWriter
String with a quote shall be espaced
-------------------------------------------------------------------------------
Json.tests.cpp:<line number>
...............................................................................
Json.tests.cpp:<line number>: PASSED:
REQUIRE( stream.str() == "\"\\\"\"" )
with expansion:
""\""" == ""\"""
-------------------------------------------------------------------------------
Lambdas in assertions
-------------------------------------------------------------------------------
@@ -9754,6 +9943,129 @@ Reporter's write listings to provided stream
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists tags
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring("fakeTag"s) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag"
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists reporters
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring("fake reporter"s) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter"
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
!false
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
JSON reporter lists tests
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) )
with expansion:
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" )
with message:
Tested reporter: JSON
-------------------------------------------------------------------------------
Reporter's write listings to provided stream
-------------------------------------------------------------------------------
Reporters.tests.cpp:<line number>
...............................................................................
Reporters.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( factories.empty() )
with expansion:
@@ -18272,6 +18584,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 413 | 308 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2230 | 2049 passed | 146 failed | 35 failed as expected
test cases: 414 | 309 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2246 | 2065 passed | 146 failed | 35 failed as expected

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2242" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2258" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -853,6 +853,16 @@ at Condition.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Newly constructed JsonWriter does nothing" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeObject will create an empty pair of braces" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeObject with key will create an object to write the value" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/nesting objects" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeArray will create an empty pair of braces" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeArray creates array to write the values to" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Moved from JsonObjectWriter shall not insert superfluous brace" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Moved from JsonArrayWriter shall not insert superfluous bracket" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Custom class shall be quoted" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/String with a quote shall be espaced" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}" status="run"/>
@@ -1190,6 +1200,9 @@ at Matchers.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists tests" time="{duration}" status="run"/>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2242" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2258" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>
@@ -852,6 +852,16 @@ at Condition.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Newly constructed JsonWriter does nothing" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeObject will create an empty pair of braces" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeObject with key will create an object to write the value" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/nesting objects" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeArray will create an empty pair of braces" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Calling writeArray creates array to write the values to" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Moved from JsonObjectWriter shall not insert superfluous brace" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Moved from JsonArrayWriter shall not insert superfluous bracket" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/Custom class shall be quoted" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="JsonWriter/String with a quote shall be espaced" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}" status="run"/>
@@ -1189,6 +1199,9 @@ at Matchers.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JSON reporter lists tests" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists tags" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists reporters" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/JUnit reporter lists tests" time="{duration}" status="run"/>

View File

@@ -130,6 +130,18 @@ at AssertionHandler.tests.cpp:<line number>
<testCase name="warmup" duration="{duration}"/>
<testCase name="weighted_average_quantile" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp">
<testCase name="JsonWriter/Newly constructed JsonWriter does nothing" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeObject will create an empty pair of braces" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeObject with key will create an object to write the value" duration="{duration}"/>
<testCase name="JsonWriter/nesting objects" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeArray will create an empty pair of braces" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeArray creates array to write the values to" duration="{duration}"/>
<testCase name="JsonWriter/Moved from JsonObjectWriter shall not insert superfluous brace" duration="{duration}"/>
<testCase name="JsonWriter/Moved from JsonArrayWriter shall not insert superfluous bracket" duration="{duration}"/>
<testCase name="JsonWriter/Custom class shall be quoted" duration="{duration}"/>
<testCase name="JsonWriter/String with a quote shall be espaced" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp">
<testCase name="Parse uints/proper inputs" duration="{duration}"/>
<testCase name="Parse uints/Bad inputs" duration="{duration}"/>
@@ -178,6 +190,9 @@ at AssertionHandler.tests.cpp:<line number>
<testCase name="Reporter's write listings to provided stream/console reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/console reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/console reporter lists tests" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists tests" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists tests" duration="{duration}"/>

View File

@@ -129,6 +129,18 @@ at AssertionHandler.tests.cpp:<line number>
<testCase name="warmup" duration="{duration}"/>
<testCase name="weighted_average_quantile" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp">
<testCase name="JsonWriter/Newly constructed JsonWriter does nothing" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeObject will create an empty pair of braces" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeObject with key will create an object to write the value" duration="{duration}"/>
<testCase name="JsonWriter/nesting objects" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeArray will create an empty pair of braces" duration="{duration}"/>
<testCase name="JsonWriter/Calling writeArray creates array to write the values to" duration="{duration}"/>
<testCase name="JsonWriter/Moved from JsonObjectWriter shall not insert superfluous brace" duration="{duration}"/>
<testCase name="JsonWriter/Moved from JsonArrayWriter shall not insert superfluous bracket" duration="{duration}"/>
<testCase name="JsonWriter/Custom class shall be quoted" duration="{duration}"/>
<testCase name="JsonWriter/String with a quote shall be espaced" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp">
<testCase name="Parse uints/proper inputs" duration="{duration}"/>
<testCase name="Parse uints/Bad inputs" duration="{duration}"/>
@@ -177,6 +189,9 @@ at AssertionHandler.tests.cpp:<line number>
<testCase name="Reporter's write listings to provided stream/console reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/console reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/console reporter lists tests" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JSON reporter lists tests" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists tags" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists reporters" duration="{duration}"/>
<testCase name="Reporter's write listings to provided stream/JUnit reporter lists tests" duration="{duration}"/>

View File

@@ -1866,6 +1866,26 @@ ok {test-number} - data.str_hello != "hell" for: "hello" != "hell"
ok {test-number} - data.str_hello != "hello1" for: "hello" != "hello1"
# Inequality checks that should succeed
ok {test-number} - data.str_hello.size() != 6 for: 5 != 6
# JsonWriter
ok {test-number} - stream.str() == "" for: "" == ""
# JsonWriter
ok {test-number} - stream.str() == "{\n}" for: "{ }" == "{ }"
# JsonWriter
ok {test-number} - stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) for: "{ "int": 1, "double": 1.5, "true": true, "false": false, "string": "this is a string", "array": [ 1, 2 ] }" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [ 1, 2 ] }" )
# JsonWriter
ok {test-number} - stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) for: "{ "empty_object": { }, "fully_object": { "key": 1 } }" ( contains: ""empty_object": { }," and contains: ""fully_object": { "key": 1 }" )
# JsonWriter
ok {test-number} - stream.str() == "[\n]" for: "[ ]" == "[ ]"
# JsonWriter
ok {test-number} - stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" for: "[ 1, 1.5, true, false, "this is a string", { "object": 42 }, [ "array", 42.5 ] ]" == "[ 1, 1.5, true, false, "this is a string", { "object": 42 }, [ "array", 42.5 ] ]"
# JsonWriter
ok {test-number} - stream.str() == "{\n}" for: "{ }" == "{ }"
# JsonWriter
ok {test-number} - stream.str() == "[\n]" for: "[ ]" == "[ ]"
# JsonWriter
ok {test-number} - stream.str() == "\"custom\"" for: ""custom"" == ""custom""
# JsonWriter
ok {test-number} - stream.str() == "\"\\\"\"" for: ""\""" == ""\"""
# Lambdas in assertions
ok {test-number} - []() { return true; }() for: true
# Less-than inequalities with different epsilons
@@ -2459,6 +2479,18 @@ ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && Cont
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fakeTag"s) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tags": [ { "aliases": [ "fakeTag" ], "count": 1 } ]" contains: "fakeTag" with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fake reporter"s) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "reporters": [ { "name": "fake reporter", "description": "fake description" } ]" contains: "fake reporter" with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "class-name": "", "tags": [ "fakeTestTag" ], "source-location": { "filename": "fake-file.cpp", "line": 123456789 } } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: JUnit'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
@@ -4489,5 +4521,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2242
1..2258

View File

@@ -1864,6 +1864,26 @@ ok {test-number} - data.str_hello != "hell" for: "hello" != "hell"
ok {test-number} - data.str_hello != "hello1" for: "hello" != "hello1"
# Inequality checks that should succeed
ok {test-number} - data.str_hello.size() != 6 for: 5 != 6
# JsonWriter
ok {test-number} - stream.str() == "" for: "" == ""
# JsonWriter
ok {test-number} - stream.str() == "{\n}" for: "{ }" == "{ }"
# JsonWriter
ok {test-number} - stream.str(), ContainsSubstring( "\"int\": 1," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) for: "{ "int": 1, "double": 1.5, "true": true, "false": false, "string": "this is a string", "array": [ 1, 2 ] }" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [ 1, 2 ] }" )
# JsonWriter
ok {test-number} - stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) && ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" ) for: "{ "empty_object": { }, "fully_object": { "key": 1 } }" ( contains: ""empty_object": { }," and contains: ""fully_object": { "key": 1 }" )
# JsonWriter
ok {test-number} - stream.str() == "[\n]" for: "[ ]" == "[ ]"
# JsonWriter
ok {test-number} - stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" for: "[ 1, 1.5, true, false, "this is a string", { "object": 42 }, [ "array", 42.5 ] ]" == "[ 1, 1.5, true, false, "this is a string", { "object": 42 }, [ "array", 42.5 ] ]"
# JsonWriter
ok {test-number} - stream.str() == "{\n}" for: "{ }" == "{ }"
# JsonWriter
ok {test-number} - stream.str() == "[\n]" for: "[ ]" == "[ ]"
# JsonWriter
ok {test-number} - stream.str() == "\"custom\"" for: ""custom"" == ""custom""
# JsonWriter
ok {test-number} - stream.str() == "\"\\\"\"" for: ""\""" == ""\"""
# Lambdas in assertions
ok {test-number} - []() { return true; }() for: true
# Less-than inequalities with different epsilons
@@ -2457,6 +2477,18 @@ ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && Cont
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fakeTag"s) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tags": [ { "aliases": [ "fakeTag" ], "count": 1 } ]" contains: "fakeTag" with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fake reporter"s) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "reporters": [ { "name": "fake reporter", "description": "fake description" } ]" contains: "fake reporter" with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) for: "{ "version": 1, "metadata": { "name": "", "rng-seed": 1234, "catch2-version": "<version>" }, "listings": { "tests": [ { "name": "fake test name", "class-name": "", "tags": [ "fakeTestTag" ], "source-location": { "filename": "fake-file.cpp", "line": 123456789 } } ]" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: JSON'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
# Reporter's write listings to provided stream
ok {test-number} - listingString, ContainsSubstring("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: JUnit'
# Reporter's write listings to provided stream
ok {test-number} - !(factories.empty()) for: !false
@@ -4478,5 +4510,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2242
1..2258

View File

@@ -420,6 +420,8 @@
##teamcity[testFinished name='Inequality checks that should fail' duration="{duration}"]
##teamcity[testStarted name='Inequality checks that should succeed']
##teamcity[testFinished name='Inequality checks that should succeed' duration="{duration}"]
##teamcity[testStarted name='JsonWriter']
##teamcity[testFinished name='JsonWriter' duration="{duration}"]
##teamcity[testStarted name='Lambdas in assertions']
##teamcity[testFinished name='Lambdas in assertions' duration="{duration}"]
##teamcity[testStarted name='Less-than inequalities with different epsilons']

View File

@@ -420,6 +420,8 @@
##teamcity[testFinished name='Inequality checks that should fail' duration="{duration}"]
##teamcity[testStarted name='Inequality checks that should succeed']
##teamcity[testFinished name='Inequality checks that should succeed' duration="{duration}"]
##teamcity[testStarted name='JsonWriter']
##teamcity[testFinished name='JsonWriter' duration="{duration}"]
##teamcity[testStarted name='Lambdas in assertions']
##teamcity[testFinished name='Lambdas in assertions' duration="{duration}"]
##teamcity[testStarted name='Less-than inequalities with different epsilons']

View File

@@ -8779,6 +8779,186 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="JsonWriter" tags="[JSON][JsonWriter]" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Section name="Newly constructed JsonWriter does nothing" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == ""
</Original>
<Expanded>
"" == ""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeObject will create an empty pair of braces" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "{\n}"
</Original>
<Expanded>
"{
}"
==
"{
}"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeObject with key will create an object to write the value" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str(), ContainsSubstring( "\"int\": 1," ) &amp;&amp; ContainsSubstring( "\"double\": 1.5," ) &amp;&amp; ContainsSubstring( "\"true\": true," ) &amp;&amp; ContainsSubstring( "\"false\": false," ) &amp;&amp; ContainsSubstring( "\"string\": \"this is a string\"," ) &amp;&amp; ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" )
</Original>
<Expanded>
"{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [
1,
2
]
}" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="nesting objects" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) &amp;&amp; ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" )
</Original>
<Expanded>
"{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeArray will create an empty pair of braces" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n]"
</Original>
<Expanded>
"[
]"
==
"[
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeArray creates array to write the values to" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]"
</Original>
<Expanded>
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Moved from JsonObjectWriter shall not insert superfluous brace" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "{\n}"
</Original>
<Expanded>
"{
}"
==
"{
}"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Moved from JsonArrayWriter shall not insert superfluous bracket" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n]"
</Original>
<Expanded>
"[
]"
==
"[
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Custom class shall be quoted" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "\"custom\""
</Original>
<Expanded>
""custom"" == ""custom""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="String with a quote shall be espaced" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "\"\\\"\""
</Original>
<Expanded>
""\""" == ""\"""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Lambdas in assertions" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Original>
@@ -11695,6 +11875,120 @@ C
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring("fakeTag"s)
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring("fake reporter"s)
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring( "fake test name"s ) &amp;&amp; ContainsSubstring( "fakeTestTag"s )
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JUnit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JUnit
@@ -21268,6 +21562,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2049" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="85" expectedFailures="14" skips="6"/>
<OverallResults successes="2065" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="309" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@@ -8779,6 +8779,186 @@ C
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="JsonWriter" tags="[JSON][JsonWriter]" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Section name="Newly constructed JsonWriter does nothing" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == ""
</Original>
<Expanded>
"" == ""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeObject will create an empty pair of braces" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "{\n}"
</Original>
<Expanded>
"{
}"
==
"{
}"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeObject with key will create an object to write the value" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str(), ContainsSubstring( "\"int\": 1," ) &amp;&amp; ContainsSubstring( "\"double\": 1.5," ) &amp;&amp; ContainsSubstring( "\"true\": true," ) &amp;&amp; ContainsSubstring( "\"false\": false," ) &amp;&amp; ContainsSubstring( "\"string\": \"this is a string\"," ) &amp;&amp; ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" )
</Original>
<Expanded>
"{
"int": 1,
"double": 1.5,
"true": true,
"false": false,
"string": "this is a string",
"array": [
1,
2
]
}" ( contains: ""int": 1," and contains: ""double": 1.5," and contains: ""true": true," and contains: ""false": false," and contains: ""string": "this is a string"," and contains: ""array": [
1,
2
]
}" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="nesting objects" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str(), ContainsSubstring( "\"empty_object\": {\n }," ) &amp;&amp; ContainsSubstring( "\"fully_object\": {\n \"key\": 1\n }" )
</Original>
<Expanded>
"{
"empty_object": {
},
"fully_object": {
"key": 1
}
}" ( contains: ""empty_object": {
}," and contains: ""fully_object": {
"key": 1
}" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeArray will create an empty pair of braces" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n]"
</Original>
<Expanded>
"[
]"
==
"[
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Calling writeArray creates array to write the values to" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]"
</Original>
<Expanded>
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
==
"[
1,
1.5,
true,
false,
"this is a string",
{
"object": 42
},
[
"array",
42.5
]
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Moved from JsonObjectWriter shall not insert superfluous brace" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "{\n}"
</Original>
<Expanded>
"{
}"
==
"{
}"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Moved from JsonArrayWriter shall not insert superfluous bracket" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "[\n]"
</Original>
<Expanded>
"[
]"
==
"[
]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Custom class shall be quoted" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "\"custom\""
</Original>
<Expanded>
""custom"" == ""custom""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="String with a quote shall be espaced" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Json.tests.cpp" >
<Original>
stream.str() == "\"\\\"\""
</Original>
<Expanded>
""\""" == ""\"""
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Lambdas in assertions" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Original>
@@ -11695,6 +11875,120 @@ C
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring("fakeTag"s)
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tags": [
{
"aliases": [
"fakeTag"
],
"count": 1
}
]" contains: "fakeTag"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring("fake reporter"s)
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"reporters": [
{
"name": "fake reporter",
"description": "fake description"
}
]" contains: "fake reporter"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JSON reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JSON
</Info>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
listingString, ContainsSubstring( "fake test name"s ) &amp;&amp; ContainsSubstring( "fakeTestTag"s )
</Original>
<Expanded>
"{
"version": 1,
"metadata": {
"name": "",
"rng-seed": 1234,
"catch2-version": "<version>"
},
"listings": {
"tests": [
{
"name": "fake test name",
"class-name": "",
"tags": [
"fakeTestTag"
],
"source-location": {
"filename": "fake-file.cpp",
"line": 123456789
}
}
]" ( contains: "fake test name" and contains: "fakeTestTag" )
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Original>
!(factories.empty())
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<Section name="JUnit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
<Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
Tested reporter: JUnit
@@ -21267,6 +21561,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2049" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="85" expectedFailures="14" skips="6"/>
<OverallResults successes="2065" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="309" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@@ -0,0 +1,116 @@
// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
// SPDX-License-Identifier: BSL-1.0
#include <catch2/catch_test_macros.hpp>
#include <catch2/internal/catch_jsonwriter.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <sstream>
namespace {
struct Custom {};
std::ostream& operator<<( std::ostream& os, Custom const& ) {
return os << "custom";
}
} // namespace
TEST_CASE( "JsonWriter", "[JSON][JsonWriter]" ) {
std::stringstream stream{};
SECTION( "Newly constructed JsonWriter does nothing" ) {
Catch::JsonValueWriter writer{ stream };
REQUIRE( stream.str() == "" );
}
SECTION( "Calling writeObject will create an empty pair of braces" ) {
{ auto writer = Catch::JsonValueWriter{ stream }.writeObject(); }
REQUIRE( stream.str() == "{\n}" );
}
SECTION( "Calling writeObject with key will create an object to write the "
"value" ) {
using Catch::Matchers::ContainsSubstring;
{
auto writer = Catch::JsonValueWriter{ stream }.writeObject();
writer.write( "int" ).write( 1 );
writer.write( "double" ).write( 1.5 );
writer.write( "true" ).write( true );
writer.write( "false" ).write( false );
writer.write( "string" ).write( "this is a string" );
writer.write( "array" ).writeArray().write( 1 ).write( 2 );
}
REQUIRE_THAT(
stream.str(),
ContainsSubstring( "\"int\": 1," ) &&
ContainsSubstring( "\"double\": 1.5," ) &&
ContainsSubstring( "\"true\": true," ) &&
ContainsSubstring( "\"false\": false," ) &&
ContainsSubstring( "\"string\": \"this is a string\"," ) &&
ContainsSubstring( "\"array\": [\n 1,\n 2\n ]\n}" ) );
}
SECTION( "nesting objects" ) {
using Catch::Matchers::ContainsSubstring;
{
auto writer = Catch::JsonValueWriter{ stream }.writeObject();
writer.write( "empty_object" ).writeObject();
writer.write( "fully_object" )
.writeObject()
.write( "key" )
.write( 1 );
}
REQUIRE_THAT( stream.str(),
ContainsSubstring( "\"empty_object\": {\n }," ) &&
ContainsSubstring(
"\"fully_object\": {\n \"key\": 1\n }" ) );
}
SECTION( "Calling writeArray will create an empty pair of braces" ) {
{ auto writer = Catch::JsonValueWriter{ stream }.writeArray(); }
REQUIRE( stream.str() == "[\n]" );
}
SECTION( "Calling writeArray creates array to write the values to" ) {
{
auto writer = Catch::JsonValueWriter{ stream }.writeArray();
writer.write( 1 );
writer.write( 1.5 );
writer.write( true );
writer.write( false );
writer.write( "this is a string" );
writer.writeObject().write( "object" ).write( 42 );
writer.writeArray().write( "array" ).write( 42.5 );
}
REQUIRE( stream.str() == "[\n 1,\n 1.5,\n true,\n false,\n \"this is a string\",\n {\n \"object\": 42\n },\n [\n \"array\",\n 42.5\n ]\n]" );
}
SECTION(
"Moved from JsonObjectWriter shall not insert superfluous brace" ) {
{
auto writer = Catch::JsonObjectWriter{ stream };
auto another_writer = std::move( writer );
}
REQUIRE( stream.str() == "{\n}" );
}
SECTION(
"Moved from JsonArrayWriter shall not insert superfluous bracket" ) {
{
auto writer = Catch::JsonArrayWriter{ stream };
auto another_writer = std::move( writer );
}
REQUIRE( stream.str() == "[\n]" );
}
SECTION( "Custom class shall be quoted" ) {
Catch::JsonValueWriter{ stream }.write( Custom{} );
REQUIRE( stream.str() == "\"custom\"" );
}
SECTION( "String with a quote shall be espaced" ) {
Catch::JsonValueWriter{ stream }.write( "\"" );
REQUIRE( stream.str() == "\"\\\"\"" );
}
}

View File

@@ -109,7 +109,9 @@ TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) {
auto sstream = Catch::Detail::make_unique<StringIStream>();
auto& sstreamRef = *sstream.get();
Catch::Config config( Catch::ConfigData{} );
Catch::ConfigData cfg_data;
cfg_data.rngSeed = 1234;
Catch::Config config( cfg_data );
auto reporter = factory.second->create( Catch::ReporterConfig{
&config, CATCH_MOVE( sstream ), Catch::ColourMode::None, {} } );