mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 21:35:40 +02:00
Add JSON reporter (#2706)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:
@@ -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," ) && ContainsSubstring( "\"double\": 1.5," ) && ContainsSubstring( "\"true\": true," ) && ContainsSubstring( "\"false\": false," ) && ContainsSubstring( "\"string\": \"this is a string\"," ) && 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 }," ) && 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 ) && 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>
|
||||
|
Reference in New Issue
Block a user