-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from inada-s/accept-gdxsv-prefixed-version
support gdxsv- prefixed flycast version
- Loading branch information
Showing
2 changed files
with
81 additions
and
17 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
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,57 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func Test_isOldFlycastVersion(t *testing.T) { | ||
type args struct { | ||
userVersion string | ||
} | ||
tests := []struct { | ||
name string | ||
requiredVersion string | ||
args args | ||
want bool | ||
}{ | ||
{ | ||
name: "same version ok", | ||
requiredVersion: "v0.7.0", | ||
args: args{userVersion: "v0.7.0"}, | ||
want: false, | ||
}, | ||
{ | ||
name: "old version ng", | ||
requiredVersion: "v0.7.0", | ||
args: args{userVersion: "v0.6.9"}, | ||
want: true, | ||
}, | ||
{ | ||
name: "new version ok", | ||
requiredVersion: "v0.7.0", | ||
args: args{userVersion: "v9.9.9"}, | ||
want: false, | ||
}, | ||
{ | ||
name: "gdxsv prefix version ok", | ||
requiredVersion: "v0.7.0", | ||
args: args{userVersion: "gdxsv-0.7.0"}, | ||
want: false, | ||
}, | ||
{ | ||
name: "gdxsv prefix version ng", | ||
requiredVersion: "v0.7.0", | ||
args: args{userVersion: "gdxsv-0.6.9"}, | ||
want: true, | ||
}, | ||
} | ||
|
||
backup := requiredFlycastVersion | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
requiredFlycastVersion = tt.requiredVersion | ||
if got := isOldFlycastVersion(tt.args.userVersion); got != tt.want { | ||
t.Errorf("isOldFlycastVersion() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
requiredFlycastVersion = backup | ||
} |