Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into generated-perl-languages
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkorstanje committed Feb 9, 2025
2 parents 2459a80 + 40b4cec commit 40d1c1a
Show file tree
Hide file tree
Showing 38 changed files with 433 additions and 337 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: 'npm'
cache-dependency-path: javascript/package-lock.json
- run: npm install-test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-rubygem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
ruby-version: '3.4'
bundler-cache: true
- uses: cucumber/[email protected]
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ on:

jobs:
test-dotnet:
# Failing on `ubuntu-24.04` (https://github.com/cucumber/gherkin/issues/349)
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
matrix:
os:
- ubuntu-latest
node-version: ["16.x", "17.x", "18.x"]
node-version: ["18.x", "20.x", "22.x", "23.x"]
include:
- os: windows-latest
node-version: "18.x"
node-version: "22.x"
- os: macos-latest
node-version: "18.x"
node-version: "22.x"

steps:
- name: set git core.autocrlf to 'input'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ jobs:
matrix:
os:
- ubuntu-latest
ruby: ['3.0', '3.1', '3.2', '3.3']
ruby: ['3.2', '3.3', '3.4']
include:
- os: macos-latest
ruby: '3.3'
ruby: '3.4'
- os: windows-latest
ruby: '3.4'

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

## [Unreleased]

### Changed
- [.NET] Reduce NuGet size by only targeting .NET Standard 2.0
- [.NET] Changed some types from class to struct, removed IGherkinLine interface and changes some functions from Array to Enumerable
- [JavaScript] BREAKING CHANGE: Update supported Node.js versions to 18, 20, 22 and 23 ([#365](https://github.com/cucumber/gherkin/pull/365))

### Fixed
- [.NET] Fix NuGet package generation

Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin.Specs/EventStubs/GherkinEventsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void AddParseError(List<Envelope> events, ParserException e, String uri)
Message = e.Message,
Source = new SourceReference()
{
Location = new Location(e.Location.Column, e.Location.Line),
Location = e.Location.HasValue ? new Location(e.Location.GetValueOrDefault().Column, e.Location.GetValueOrDefault().Line) : null,
Uri = uri
}
}
Expand Down
5 changes: 3 additions & 2 deletions dotnet/Gherkin.Specs/Gherkin.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0;net8.0;net472</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net472</TargetFrameworks>
<OutputType>Exe</OutputType>
<StartupObject>Gherkin.Specs.CLI.Program</StartupObject>
</PropertyGroup>
Expand All @@ -10,7 +11,7 @@
<PackageReference Include="FluentAssertions" Version="7.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
12 changes: 7 additions & 5 deletions dotnet/Gherkin.Specs/Tokens/TestTokenFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public string FormatToken(Token token)
if (token.IsEOF)
return "EOF";

string stepTypeText;
string stepTypeText = string.Empty;
string matchedItemsText = null;
switch (token.MatchedType)
{
case TokenType.FeatureLine:
Expand All @@ -22,13 +23,14 @@ public string FormatToken(Token token)
var tokenType = token.MatchedGherkinDialect.GetStepKeywordType(token.MatchedKeyword);
stepTypeText = $"({tokenType})";
break;
default:
stepTypeText = "";
case TokenType.TagLine:
matchedItemsText = string.Join(",", token.Line.GetTags().Select(i => i.Column + ":" + i.Text));
break;
case TokenType.TableRow:
matchedItemsText = string.Join(",", token.Line.GetTableCells().Select(i => i.Column + ":" + i.Text));
break;
}

var matchedItemsText = token.MatchedItems == null ? "" : string.Join(",", token.MatchedItems.Select(i => i.Column + ":" + i.Text));

return $"({token.Location.Line}:{token.Location.Column}){token.MatchedType}:{stepTypeText}{token.MatchedKeyword}/{token.MatchedText}/{matchedItemsText}";
}
}
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Background.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Gherkin.Ast;

public class Background(Location location, string keyword, string name, string description, Step[] steps)
public class Background(Location location, string keyword, string name, string description, IEnumerable<Step> steps)
: StepsContainer(location, keyword, name, description, steps);
4 changes: 2 additions & 2 deletions dotnet/Gherkin/Ast/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ public class DataTable : StepArgument, IHasRows, IHasLocation
public Location Location { get; private set; }
public IEnumerable<TableRow> Rows { get; private set; }

public DataTable(TableRow[] rows)
public DataTable(List<TableRow> rows)
{
if (rows == null) throw new ArgumentNullException("rows");
if (rows.Length == 0) throw new ArgumentException("DataTable must have at least one row", "rows");
if (rows.Count == 0) throw new ArgumentException("DataTable must have at least one row", "rows");

Location = rows[0].Location;
Rows = rows;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Examples.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class Examples(Tag[] tags, Location location, string keyword, string name, string description, TableRow header, TableRow[] body)
public class Examples(IEnumerable<Tag> tags, Location location, string keyword, string name, string description, TableRow header, IEnumerable<TableRow> body)
: IHasLocation, IHasDescription, IHasRows, IHasTags
{
public IEnumerable<Tag> Tags { get; } = tags;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Feature.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class Feature(Tag[] tags, Location location, string language, string keyword, string name, string description, IHasLocation[] children)
public class Feature(IEnumerable<Tag> tags, Location location, string language, string keyword, string name, string description, IEnumerable<IHasLocation> children)
: IHasLocation, IHasDescription, IHasTags, IHasChildren
{
public IEnumerable<Tag> Tags { get; } = tags;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/GherkinDocument.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class GherkinDocument(Feature feature, Comment[] comments)
public class GherkinDocument(Feature feature, IEnumerable<Comment> comments)
{
public Feature Feature { get; } = feature;
public IEnumerable<Comment> Comments { get; } = comments;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Location.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class Location(int line = 0, int column = 0)
public readonly struct Location(int line = 0, int column = 0)
{
public int Line { get; } = line;
public int Column { get; } = column;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Rule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class Rule(Tag[] tags, Location location, string keyword, string name, string description, IHasLocation[] children)
public class Rule(IEnumerable<Tag> tags, Location location, string keyword, string name, string description, IEnumerable<IHasLocation> children)
: IHasLocation, IHasDescription, IHasChildren, IHasTags
{
public Location Location { get; } = location;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/Scenario.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
public class Scenario(IEnumerable<Tag> tags, Location location, string keyword, string name, string description, IEnumerable<Step> steps, IEnumerable<Examples> examples)
: StepsContainer(location, keyword, name, description, steps), IHasTags
{
public IEnumerable<Tag> Tags { get; } = tags;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/StepsContainer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public abstract class StepsContainer(Location location, string keyword, string name, string description, Step[] steps)
public abstract class StepsContainer(Location location, string keyword, string name, string description, IEnumerable<Step> steps)
: IHasLocation, IHasDescription, IHasSteps
{
public Location Location { get; } = location;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/TableCell.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class TableCell(Location location, string value) : IHasLocation
public readonly struct TableCell(Location location, string value) : IHasLocation
{
public Location Location { get; } = location;
public string Value { get; } = value;
Expand Down
2 changes: 1 addition & 1 deletion dotnet/Gherkin/Ast/TableRow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Gherkin.Ast;

public class TableRow(Location location, TableCell[] cells) : IHasLocation
public class TableRow(Location location, IEnumerable<TableCell> cells) : IHasLocation
{
public Location Location { get; } = location;
public IEnumerable<TableCell> Cells { get; } = cells;
Expand Down
Loading

0 comments on commit 40d1c1a

Please sign in to comment.