-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(test): update CI tests to cover
gno test
default directory behavior
- Loading branch information
Nemanya21
committed
Jan 5, 2025
1 parent
28e79fe
commit cf6382b
Showing
6 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
# Run gno test without path argument on an empty dir | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr '[no test files]' |
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,8 @@ | ||
# Test empty gno without path argument | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr '\? \. \[no test files\]' | ||
|
||
-- empty.gno -- |
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,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) {}) | ||
} | ||
} |
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,26 @@ | ||
# Test with a valid _filetest.gno file | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
gno test -v | ||
|
||
stdout 'test' | ||
stderr '=== RUN file/valid_filetest.gno' | ||
stderr '--- PASS: file/valid_filetest.gno \(\d\.\d\ds\)' | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
-- valid.gno -- | ||
package valid | ||
|
||
-- valid_filetest.gno -- | ||
package main | ||
|
||
func main() { | ||
println("test") | ||
} | ||
|
||
// Output: | ||
// test |
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,18 @@ | ||
# Test with a valid _test.gno file without path argument | ||
|
||
gno test | ||
|
||
! stdout .+ | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
-- valid.gno -- | ||
package valid | ||
|
||
-- valid_test.gno -- | ||
package valid | ||
|
||
import "testing" | ||
|
||
func TestAlwaysValid(t *testing.T) { | ||
// noop | ||
} |