-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce unit tests, drop auto_kill_prefix
- Loading branch information
1 parent
d528dbc
commit daf60c7
Showing
7 changed files
with
113 additions
and
37 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 |
---|---|---|
|
@@ -2,7 +2,6 @@ name: "Close Stale Issues" | |
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
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,22 +1,19 @@ | ||
name: Build | ||
name: Go | ||
on: | ||
push: | ||
pull_request: | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Setup Go' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.20' | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@v3 | ||
- name: 'Setup Go' | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.21' | ||
- name: 'Run tests' | ||
run: make tests | ||
- name: 'Build Vinegar' | ||
run: make VINEGAR_GOFLAGS="--tags nogui" |
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
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,81 @@ | ||
package config | ||
|
||
import ( | ||
"errors" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
func TestGlobal(t *testing.T) { | ||
c := Config{ | ||
env: Environment{ | ||
"MEOW": "DEPRECATED", | ||
}, | ||
Global: Binary{ | ||
Launcher: "meow", | ||
Env: Environment{ | ||
"MEOW": "GLOBAL", | ||
}, | ||
}, | ||
Player: Binary{ | ||
Env: Environment{ | ||
"MEOW": "PLAYER", | ||
}, | ||
}, | ||
} | ||
|
||
if err := c.globalize(); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if c.Global.Env["MEOW"] != "DEPRECATED" { | ||
t.Error("expected env overrides global env") | ||
} | ||
|
||
if c.Player.Launcher != "meow" && c.Studio.Launcher != "meow" { | ||
t.Error("expected player or/and studio applies global launcher") | ||
} | ||
|
||
if c.Player.Env["MEOW"] != "PLAYER" { | ||
t.Error("expected player overrides global env") | ||
} | ||
|
||
if c.Studio.Env["MEOW"] != "DEPRECATED" { | ||
t.Error("expected studio applies global env") | ||
} | ||
} | ||
|
||
func TestBinarySetup(t *testing.T) { | ||
var b Binary | ||
|
||
if err := b.setup(); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
b.Renderer = "Meow" | ||
if err := b.setup(); !errors.Is(err, ErrInvalidRenderer) { | ||
t.Error("expected renderer check") | ||
} | ||
|
||
b.Dxvk = true | ||
b.Renderer = "Vulkan" | ||
if err := b.setup(); !errors.Is(err, ErrNeedDXVKRenderer) { | ||
t.Error("expected dxvk appropiate renderer check") | ||
} | ||
} | ||
|
||
func TestSetup(t *testing.T) { | ||
wr := t.TempDir() | ||
c := Config{ | ||
WineRoot: wr, | ||
} | ||
|
||
if err := c.setup(); !errors.Is(err, ErrWineRootInvalid) { | ||
t.Error("expected wine root wine check") | ||
} | ||
|
||
c.WineRoot = filepath.Join(".", wr) | ||
if err := c.setup(); !errors.Is(err, ErrWineRootAbs) { | ||
t.Error("expected wine root absolute path") | ||
} | ||
} |