mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 16:39:35 +08:00

* Test release workflow * Update release.yml * Update release.yml * add linux deps * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Fix: Misc tests * Fix: Misc tests + linux build tags * Fix: Bindings tests + move templates to pkg. Add json schema for templates * Fix: template tests * Add tests to release workflow. Test for go 1.18 + go 1.19 Fix: ignore .m files for non darwin builds. Fix watcher test. Fix warning in clilogger. * Fix release pipeline * Matrix for tests * Rename templates to make tests work * Update template test * Debug template test * Debug template test * Debug template test * Fix gitignore * Update release.yml
38 lines
762 B
Go
38 lines
762 B
Go
package keys
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/matryer/is"
|
|
)
|
|
|
|
func TestParse(t *testing.T) {
|
|
|
|
i := is.New(t)
|
|
|
|
type args struct {
|
|
Input string
|
|
Expected *Accelerator
|
|
}
|
|
|
|
gooddata := []args{
|
|
{"CmdOrCtrl+A", CmdOrCtrl("A")},
|
|
{"SHIFT+.", Shift(".")},
|
|
{"CTRL+plus", Control("+")},
|
|
{"CTRL+SHIFT+escApe", Combo("escape", ControlKey, ShiftKey)},
|
|
{";", Key(";")},
|
|
{"OptionOrAlt+Page Down", OptionOrAlt("Page Down")},
|
|
}
|
|
for _, tt := range gooddata {
|
|
result, err := Parse(tt.Input)
|
|
i.NoErr(err)
|
|
i.Equal(result, tt.Expected)
|
|
}
|
|
baddata := []string{"CmdOrCrl+A", "SHIT+.", "CTL+plus", "CTRL+SHIF+esApe", "escap", "Sper+Tab", "OptionOrAlt"}
|
|
for _, d := range baddata {
|
|
result, err := Parse(d)
|
|
i.True(err != nil)
|
|
i.Equal(result, nil)
|
|
}
|
|
}
|