-
Notifications
You must be signed in to change notification settings - Fork 6
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
CC-1318 Add support for the --previous flag for the test command #33
Conversation
cmd/codecrafters/main.go
Outdated
$ codecrafters test # Run tests without committing changes | ||
$ codecrafters submit # Commit changes & submit to move to next step | ||
$ codecrafters test # Run tests without committing changes | ||
$ codecrafters test --previous # Run tests for the current stage and all previous stages in ascending order |
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.
$ codecrafters test --previous # Run tests for the current stage and all previous stages in ascending order | |
$ codecrafters test --previous # Run tests for previous stages without committing changes |
Let's just say this for now - in the future we'll change the actual behaviour to match this.
cmd/codecrafters/main.go
Outdated
|
||
COMMANDS | ||
test: Run tests without committing changes | ||
|
||
Flags for test: | ||
--previous Run tests for the current stage and all previous stages in ascending order |
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.
Let's remove the flags
section from here for now - will think about how to do proper flags per command. We need a better system for this - something like codecrafters test --help
.
cmd/codecrafters/main.go
Outdated
@@ -76,7 +81,11 @@ func run() error { | |||
|
|||
switch cmd { | |||
case "test": | |||
return commands.TestCommand(ctx) | |||
testCmd := flag.NewFlagSet("test", flag.ExitOnError) | |||
previous := testCmd.Bool("previous", false, "run tests for the current stage and all previous stages in ascending order") |
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.
previous := testCmd.Bool("previous", false, "run tests for the current stage and all previous stages in ascending order") | |
shouldTestPrevious := testCmd.Bool("previous", false, "run tests for the current stage and all previous stages in ascending order") |
return commands.TestCommand(ctx) | ||
testCmd := flag.NewFlagSet("test", flag.ExitOnError) | ||
previous := testCmd.Bool("previous", false, "run tests for the current stage and all previous stages in ascending order") | ||
testCmd.Parse(flag.Args()[1:]) // parse the args after the test command |
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.
Just curious - what happens if a user makes a typo here? If they do codecrafters test --previos
for example? Will this complain? (Ideally it should)
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.
"stage_selection_strategy": "current_and_previous_descending", | ||
} | ||
|
||
if previous { |
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 decision should be one layer above, in the caller. A "client" for core shouldn't be aware of anything other than what core supports. We should accept stageSelectionStrategy
here, and have the caller decide what value to pass in.
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.
Added q
…ious to shouldTestPrevious
…lled in the submit command
…layer up in caller
cmd/codecrafters/main.go
Outdated
$ codecrafters test # Run tests without committing changes | ||
$ codecrafters submit # Commit changes & submit to move to next step | ||
$ codecrafters test # Run tests without committing changes | ||
$ codecrafters test --previous # Run tests for the current stage and all previous stages without comitting changes |
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.
$ codecrafters test --previous # Run tests for the current stage and all previous stages without comitting changes | |
$ codecrafters test --previous # Run tests for the current stage and all previous stages without committing changes |
No description provided.