-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 1.21.0 pass through regression #872
Merged
Merged
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
4381738
wip regression test
coilysiren e265f50
cleanup tests
coilysiren 6e89173
comment out tests
coilysiren 74cd3bc
cleanup tests
coilysiren 4fb1878
show test failures
coilysiren e042de5
Merge remote-tracking branch 'origin/master' into pass-through-regres…
15dc34e
more accurate regression reproduction
c542fb3
temp remove
b0ed044
add regression test to its own file
192ce00
expand name
2172d38
update tests
810b971
cleanup
0f9d8a9
expand test cases
406a1c3
update vars and args
2071bcf
checkpoint
bfeb4c8
Merge branch 'master' into pass-through-regression
4a4b9f4
Merge https://github.com/urfave/cli into pass-through-regression
coilysiren 7d0751f
add argIsFlag check
fcfc69e
Merge remote-tracking branch 'origin/master' into pass-through-regres…
49dbeed
handle `=` input
10682fb
docs
09cdbbf
more docs
223e217
swap a test case
6da413a
fix go version support?
bfdd794
docs
3f6f977
Update command.go
72c2493
Update command.go
41eb645
Merge branch 'master' into pass-through-regression
aac6dd4
Merge branch 'master' into pass-through-regression
d7af485
Merge branch 'pass-through-regression' of https://github.com/urfave/c…
coilysiren 5125980
better leading dash handling
coilysiren be0cc4b
add a check
coilysiren 64d3555
trim whitespace
coilysiren 8be7bc4
Merge branch 'master' into pass-through-regression
c30b1cf
Merge branch 'master' into pass-through-regression
0480001
Merge branch 'master' into pass-through-regression
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package cli | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
// TestRegression tests a regression that was merged between versions 1.20.0 and 1.21.0 | ||
// The included app.Run line worked in 1.20.0, and then was broken in 1.21.0. | ||
// Relevant PR: https://github.com/urfave/cli/pull/872 | ||
func TestVersionOneTwoOneRegression(t *testing.T) { | ||
testData := []struct { | ||
testCase string | ||
appRunInput []string | ||
skipArgReorder bool | ||
}{ | ||
{ | ||
testCase: "with_dash_dash", | ||
appRunInput: []string{"cli", "command", "--flagone", "flagvalue", "--", "docker", "image", "ls", "--no-trunc"}, | ||
}, | ||
{ | ||
testCase: "with_dash_dash_and_skip_reorder", | ||
appRunInput: []string{"cli", "command", "--flagone", "flagvalue", "--", "docker", "image", "ls", "--no-trunc"}, | ||
skipArgReorder: true, | ||
}, | ||
{ | ||
testCase: "without_dash_dash", | ||
appRunInput: []string{"cli", "command", "--flagone", "flagvalue", "docker", "image", "ls", "--no-trunc"}, | ||
}, | ||
{ | ||
testCase: "without_dash_dash_and_skip_reorder", | ||
appRunInput: []string{"cli", "command", "--flagone", "flagvalue", "docker", "image", "ls", "--no-trunc"}, | ||
skipArgReorder: true, | ||
}, | ||
} | ||
for _, test := range testData { | ||
t.Run(test.testCase, func(t *testing.T) { | ||
// setup | ||
app := NewApp() | ||
app.Commands = []Command{{ | ||
Name: "command", | ||
SkipArgReorder: test.skipArgReorder, | ||
Flags: []Flag{ | ||
StringFlag{ | ||
Name: "flagone", | ||
}, | ||
}, | ||
Action: func(c *Context) error { return nil }, | ||
}} | ||
|
||
// logic under test | ||
err := app.Run(test.appRunInput) | ||
|
||
// assertions | ||
if err != nil { | ||
t.Errorf("did not expected an error, but there was one: %s", err) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a possibility as it would be false by default! It's fine if you don't change it too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna opt against adding this into the PR - but only because I wanna merge this ASAP so that we can fix the regression 🔧