-
Notifications
You must be signed in to change notification settings - Fork 418
feat(cmd/gno): allow gno test to default to the current directory #3453
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5650b2
feat(test): allow `gno test` to default to the current directory
22803a2
ci(test): update CI tests to cover `gno test` default directory behavior
fe529ad
refactor(test): remove redundant tests
Nemanya8 6064239
feat(test): remove redundant checks for improved performance
ea37e64
Merge branch 'master' into no_args
leohhhn 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,6 @@ | ||
# Run gno test without path argument on an empty dir | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr '[no test files]' |
This file contains hidden or 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,8 @@ | ||
# Test empty gno without path argument | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr '\? \. \[no test files\]' | ||
|
||
-- empty.gno -- |
This file contains hidden or 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,99 @@ | ||
# Run test on gno.land/p/demo/ufmt without path argument | ||
|
||
gno test | ||
|
||
gno test -v | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
stderr '=== RUN TestRun/hi_you' | ||
stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run .* | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
stderr '=== RUN TestRun/hi_you' | ||
stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run NotExists | ||
|
||
! stdout .+ | ||
! stderr '=== RUN TestRun' | ||
|
||
gno test -v -run .*/hello | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
! stderr '=== RUN TestRun/hi_you' | ||
! stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run .*/hi | ||
|
||
! stdout .+ | ||
! stderr '=== RUN TestRun/hello' | ||
stderr '=== RUN TestRun/hi_you' | ||
stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run .*/NotExists | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run Run/.* | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
stderr '=== RUN TestRun/hi_you' | ||
stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run Run/ | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
stderr '=== RUN TestRun/hi_you' | ||
stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
gno test -v -run Run/hello | ||
|
||
! stdout .+ | ||
stderr '=== RUN TestRun/hello' | ||
! stderr '=== RUN TestRun/hi_you' | ||
! stderr '=== RUN TestRun/hi_me' | ||
stderr '=== RUN TestRun' | ||
stderr '--- PASS: TestRun' | ||
|
||
-- run.gno -- | ||
package run | ||
|
||
-- run_test.gno -- | ||
package run | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestRun(t *testing.T) { | ||
cases := []string { | ||
"hello", | ||
"hi you", | ||
"hi me", | ||
} | ||
for _, tc := range cases { | ||
t.Run(tc, func(t *testing.T) {}) | ||
} | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.