83 lines
3.4 KiB
Gherkin
Raw Permalink Normal View History

2020-04-26 19:09:58 +02:00
@Coverage
Feature: CodeGenerator
2019-09-10 22:48:25 +02:00
In order to ensure that the generator backend produces valid output
As a contributor
I want to get notified when there is any deviation from reference output
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario: Comparing backend output with reference
Given I have a binary code generator request "test.capnp.bin"
And my reference output is "test.cs"
When I invoke capnpc-csharp
Then the generated output must match the reference
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario Outline: Invalid binary code generator requests
Given I have a binary code generator request <bin>
When I invoke capnpc-csharp
Then the invocation must fail
Examples:
| bin |
| null.bin |
| test.cs |
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario: Combining frontend and backend
Given capnp.exe is installed on my system
And I have a schema "UnitTest1.capnp"
When I try to generate code from that schema
Then code generation must succeed
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario: Missing frontend
Given capnp.exe is not installed on my system
And I have a schema "UnitTest1.capnp"
When I try to generate code from that schema
Then the invocation must fail
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario: Schema without ID
Given capnp.exe is installed on my system
And I have a schema "Empty1.capnp"
When I try to generate code from that schema
Then the invocation must fail
And the reason must be bad input
And the error output must contain "File does not declare an ID"
2020-04-26 19:09:58 +02:00
@Coverage
2019-09-10 22:48:25 +02:00
Scenario: Multiple errors
Given capnp.exe is installed on my system
And I have a schema "invalid.capnp"
When I try to generate code from that schema
Then the invocation must fail
And the reason must be bad input
And the error output must contain multiple messages
2019-10-19 13:52:16 +02:00
2020-04-26 19:09:58 +02:00
@Coverage
2019-10-19 13:52:16 +02:00
Scenario Outline: Valid generator output
Given I have a binary code generator request <bin>
2020-01-30 21:53:08 +01:00
And I enable generation of nullable reference types according to <nullablegen>
And I enable the compiler support of nullable reference types according to <nullablesupp>
2019-10-19 13:52:16 +02:00
When I invoke capnpc-csharp
2020-01-30 21:53:08 +01:00
Then the invocation must succeed and attempting to compile the generated code gives <outcome>
2019-10-19 13:52:16 +02:00
Examples:
2020-02-08 17:23:07 +01:00
| bin | nullablegen | nullablesupp | outcome |
| test.capnp.bin | false | false | success |
| test.capnp.bin | true | false | errors |
| test.capnp.bin | false | true | warnings |
| test.capnp.bin | true | true | success |
| Issue19.capnp.bin | false | false | success |
| Issue21.capnp.bin | false | false | success |
| Issue22.capnp.bin | false | false | success |
2020-01-30 21:53:08 +01:00
| NullableDisable.capnp.bin | true | false | success |
| NullableDisable.capnp.bin | true | true | warnings |
| NullableEnable.capnp.bin | false | true | success |
2020-02-08 17:23:07 +01:00
| NullableEnable.capnp.bin | false | false | errors |
| NullableDisable2.capnp.bin | false | false | errors |
| NullableDisable2.capnp.bin | false | true | success |
| NullableEnable2.capnp.bin | false | false | errors |
| NullableEnable2.capnp.bin | false | true | success |
| rpc-csharp.capnp.bin | true | true | warnings |
| schema-csharp.capnp.bin | false | false | success |