Skip to content

Code generator produces platform-dependent escaped line endings in string literals instead of following the line endings used in .feature files #996

Description

@JefSchraag

Reqnroll Version

3.3.1

Which test runner are you using?

NUnit

Test Runner Version Number

n/a

.NET Implementation

.NET 8.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

n/a

Issue Description

Generated *.feature.cs files should contain identical string literal content regardless of the platform where code generation occurs. The code generator should respect and follow the line ending configuration of the source *.feature files as defined in .gitattributes, using consistent escape sequences in C# string literals (\n vs \r\n) across all platforms.

Steps to Reproduce

Create a .gitattributes file:

# Explicitly declare feature files to always be normalized and converted to LF on checkout
*.feature text eol=lf

Create a feature file:

Feature: Testing line breaks

This is
a description
with line breaks

Observe the generated code on Mac:

private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Testing line breaks", "This is\na description\nwith line breaks", global::Reqnroll.ProgrammingLanguage.CSharp, featureTags, InitializeCucumberMessages());

Observe the generated code on Windows:

private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Testing line breaks", "This is\r\na description\r\nwith line breaks", global::Reqnroll.ProgrammingLanguage.CSharp, featureTags, InitializeCucumberMessages());

I would expect that since the line breaks are normalized to \n in the feature file (even on Windows), the generated code would be consistent across platforms.

Link to Repro Project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions