cucumber / cucumber/godog

Tag Filtering Expressions

Open
#613 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.7k
Forks
280
Avg merge
2d 20h
Merged PRs (30d)
2

Description

### 👓 What did you see?

tag filtering doesn't support nesting parentheses (more of a feature), nor does it implement commutativity of boolean algebra (why I made this a bug).

[source code implementation](https://github.com/cucumber/godog/blob/27ad3c245e89ca7490a27132c6dd641bd3dcc87a/internal/tags/tag_filter.go)

### ✅ What did you expect to see?

Parentheses and PEMDAS respect.

### 📦 Which tool/library version are you using?
v0.14.0

### 🔬 How could we reproduce it?
could use above example in newest release.

Steps to reproduce the behavior:
1. Install '...' version '...'
2. Create a file called '....'
3. Run command '....'
4. See error '....'

example test cases that I would hope for from [the unit testing](https://github.com/cucumber/godog/blob/27ad3c245e89ca7490a27132c6dd641bd3dcc87a/internal/tags/tag_filter_test.go#L21-L42)

```golang
var testcases = []testcase{
...
{filter: "@ten, (@one && @two)", expected: []*pickle{p2, p3}}, // evaluate `,` second by setting parentheses, a feature
{filter: "@three && @two, @one", expected: []*pickle{p1, p2, p3}}, // evaluate `,` and `&&` left to right, a bug (current behavior would be to only pass p3)
...
}
```

### 📚 Any additional context?

----

*This text was originally generated from a [template](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates), then edited by hand. [You can modify the template here.](https://github.com/cucumber/.github/edit/main/.github/ISSUE_TEMPLATE/bug_report.md)*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.