-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add
d
command for setting/clearing the test seed (#112)
- Loading branch information
1 parent
ce32cbb
commit aa6a2b5
Showing
10 changed files
with
285 additions
and
116 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule MixTestInteractive.Command.Seed do | ||
@moduledoc """ | ||
Specify or clear the random number seed for test runs. | ||
Runs the tests with the given seed if provided. If not provided, the seed is | ||
cleared and the tests will run with a random seed as usual. | ||
""" | ||
use MixTestInteractive.Command, command: "d", desc: "set or clear the test seed" | ||
|
||
alias MixTestInteractive.Command | ||
alias MixTestInteractive.Settings | ||
|
||
@impl Command | ||
def name, do: "d [<seed>]" | ||
|
||
@impl Command | ||
def run([], %Settings{} = settings) do | ||
{:ok, Settings.clear_seed(settings)} | ||
end | ||
|
||
@impl Command | ||
def run([seed], %Settings{} = settings) do | ||
{:ok, Settings.with_seed(settings, seed)} | ||
end | ||
end |
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
Oops, something went wrong.