Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/release-nuget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release NuGet

on:
push:
branches: [ release/* ]

jobs:
publish-nuget:
name: Publish package to NuGet.org
# Failing on `ubuntu-24.04` (https://github.com/cucumber/gherkin/issues/349)
runs-on: ubuntu-22.04
environment: Release
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
- uses: cucumber/[email protected]
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
working-directory: "dotnet"
32 changes: 32 additions & 0 deletions .github/workflows/test-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: test-dotnet

on:
push:
branches:
- main
- renovate/**
paths:
- dotnet/**
- testdata/**
- .github/**
pull_request:
branches:
- main
paths:
- dotnet/**
- testdata/**
- .github/**
workflow_call:

jobs:
test-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
- run: dotnet test
working-directory: dotnet
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Render the empty tag expression as an empty string ([#222](https://github.com/cucumber/tag-expressions/pull/222))
- Improve error message for missing operands ([#221](https://github.com/cucumber/tag-expressions/pull/221))

- [.NET] Add a .NET implementation

## [8.0.0] - 2025-10-14
### Fixed
- [Perl] Fix building release artifacts ([#214](https://github.com/cucumber/tag-expressions/pull/214))
Expand Down
13 changes: 13 additions & 0 deletions dotnet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root=true

[*]
indent_style=space
end_of_line=crlf
charset=utf-8

[*.{csproj,props}]
indent_size=2

[*.cs]
indent_size=4
insert_final_newline = true
178 changes: 178 additions & 0 deletions dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
*.ide

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Oo]bj/
*/**/bin

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

packages/
acceptance/
output/
.built
.compared
.sln_built_debug
*.userprefs
*.nupkg
Gherkin.NuGetPackages/bin/
.build*
.built*
.vscode
.run_tests
.generated
.packed
.tested
.fixprotoc
.vs/

# ========================
31 changes: 31 additions & 0 deletions dotnet/Cucumber.TagExpressions.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cucumber.TagExpressions", "TagExpressions\Cucumber.TagExpressions.csproj", "{0BDD57B5-52F9-4866-8031-C84E41138453}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cucumber.TagExpressionsTest", "TagExpressionsTest\Cucumber.TagExpressionsTest.csproj", "{EBEAC0FF-9EA0-4065-B39E-B9C4C29EE48A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0BDD57B5-52F9-4866-8031-C84E41138453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BDD57B5-52F9-4866-8031-C84E41138453}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BDD57B5-52F9-4866-8031-C84E41138453}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BDD57B5-52F9-4866-8031-C84E41138453}.Release|Any CPU.Build.0 = Release|Any CPU
{EBEAC0FF-9EA0-4065-B39E-B9C4C29EE48A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBEAC0FF-9EA0-4065-B39E-B9C4C29EE48A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBEAC0FF-9EA0-4065-B39E-B9C4C29EE48A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBEAC0FF-9EA0-4065-B39E-B9C4C29EE48A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0789D1F0-C759-4F1D-BED0-F55A1E05100B}
EndGlobalSection
EndGlobal
Binary file added dotnet/Cucumber.TagExpressions.snk
Binary file not shown.
10 changes: 10 additions & 0 deletions dotnet/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>

<PropertyGroup>
<LangVersion>13</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add <Nullable>enable</Nullable> here and handle nullable details.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</PropertyGroup>

</Project>
21 changes: 21 additions & 0 deletions dotnet/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Cucumber Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[![NuGet Version](https://img.shields.io/nuget/v/Cucumber.TagExpressions)](https://www.nuget.org/packages/Cucumber.TagExpressions)

# Cucumber Tag Expressions for .NET

[The docs are here](https://cucumber.io/docs/cucumber/api/#tag-expressions).
41 changes: 41 additions & 0 deletions dotnet/TagExpressions/Cucumber.TagExpressions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>1591</NoWarn>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Cucumber.TagExpressions.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<PropertyGroup Label="Version">
<VersionNumber>8.0.0</VersionNumber>
<Version Condition="'$(SnapshotSuffix)' != ''">$(VersionNumber)-$(SnapshotSuffix)</Version>
<Version Condition="'$(SnapshotSuffix)' == ''">$(VersionNumber)</Version>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\Resources\cucumber-mark-green-128.png">
<Pack>True</Pack>
<PackagePath>.</PackagePath>
<Visible>true</Visible>
</None>
</ItemGroup>

<PropertyGroup Label="Package Properties">
<Product>Cucumber.TagExpressions</Product>
<PackageId>Cucumber.TagExpressions</PackageId>
<Authors>Cucumber Ltd, Chris Rudolphi</Authors>
<Copyright>Copyright &#xA9; Cucumber Ltd, Chris Rudolphi</Copyright>
<Description>Tag Expressions is a simple query language for Cucumber tags.</Description>
<PackageTags>reqnroll gherkin cucumber</PackageTags>
<PackageProjectUrl>https://github.com/cucumber/tag-expressions</PackageProjectUrl>
<RepositoryUrl>https://github.com/cucumber/tag-expressions</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>cucumber-mark-green-128.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>bin/$(Configuration)/NuGet</PackageOutputPath>
</PropertyGroup>

</Project>
20 changes: 20 additions & 0 deletions dotnet/TagExpressions/ITagExpression.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Cucumber.TagExpressions;

/// <summary>
/// Represents a tag expression that can be evaluated against a set of input tags.
/// </summary>
public interface ITagExpression
{
/// <summary>
/// Evaluates the tag expression against the provided input tags.
/// </summary>
/// <param name="inputs">A collection of input tags to evaluate against.</param>
/// <returns><c>true</c> if the expression matches the inputs; otherwise, <c>false</c>.</returns>
bool Evaluate(IEnumerable<string> inputs);

/// <summary>
/// Returns the string representation of the tag expression.
/// </summary>
/// <returns>A string that represents the tag expression.</returns>
string ToString();
}
Loading
Loading