-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6afa762
commit fba6981
Showing
2 changed files
with
50 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
name: Go | ||
name: Build and Test | ||
on: [push] | ||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
|
||
|
||
- name: Build, run tests and vet | ||
run: | | ||
go build | ||
go test | ||
go vet | ||
env: | ||
GO111MODULE: "on" | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
|
||
- name: Build, run tests and vet | ||
run: | | ||
go build | ||
go test | ||
go vet | ||
env: | ||
GO111MODULE: "on" |
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,35 @@ | ||
package dcrlibwallet_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
"testing/quick" | ||
|
||
. "github.com/raedahgroup/dcrlibwallet" | ||
) | ||
|
||
// canUseDir returns true if the program can create the directory | ||
// if it doesn't exist or the directory is empty if it exists. | ||
// If will delete the directory if it is empty. | ||
func canUseDir(directory string) bool { | ||
if os.MkdirAll(directory, os.ModePerm) == nil { | ||
return os.Remove(directory) == nil | ||
} | ||
return false | ||
} | ||
|
||
// TestNewMultiWallet tests if NewMultiWallet will return an error for valid | ||
// paths or not return an error for invalid paths | ||
func TestNewMultiWallet(t *testing.T) { | ||
f := func(rootDir string) bool { | ||
canUse := canUseDir(rootDir) | ||
_, err := NewMultiWallet(rootDir, "", "testnet") | ||
if canUse { | ||
return err == nil | ||
} | ||
return err != nil | ||
} | ||
if err := quick.Check(f, nil); err != nil { | ||
t.Error(err) | ||
} | ||
} |