This repository has been archived by the owner on May 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
6 changed files
with
92 additions
and
6 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
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,57 @@ | ||
package remotecheck | ||
|
||
type Support uint | ||
|
||
const ( | ||
SupportUndefined Support = iota // zero value | ||
SupportNative | ||
SupportTransition | ||
SupportInDevelopment | ||
SupportNotYet | ||
SupportUnknown | ||
) | ||
|
||
func (s *Support) Parse(str string) Support { | ||
switch str { | ||
case "✅": | ||
*s = SupportNative | ||
|
||
case "✳️": | ||
*s = SupportTransition | ||
|
||
case "⏹": | ||
*s = SupportInDevelopment | ||
|
||
case "🚫": | ||
*s = SupportNotYet | ||
|
||
case "🔶": | ||
*s = SupportUnknown | ||
|
||
} | ||
|
||
return *s | ||
} | ||
|
||
func (s Support) String() string { | ||
switch s { | ||
case SupportNative: | ||
return "Supported" | ||
|
||
case SupportTransition: | ||
return "Supported *" | ||
|
||
case SupportInDevelopment: | ||
return "Unsupported" | ||
|
||
case SupportNotYet: | ||
return "Unsupported" | ||
|
||
case SupportUnknown: | ||
return "Unknown" | ||
|
||
default: | ||
return "" | ||
|
||
} | ||
} |
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,29 @@ | ||
package remotecheck | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestSupport_Parse(t *testing.T) { | ||
tests := []struct { | ||
in string | ||
expected Support | ||
}{ | ||
{"✅", SupportNative}, | ||
{"✳️", SupportTransition}, | ||
{"⏹", SupportInDevelopment}, | ||
{"🚫", SupportNotYet}, | ||
{"🔶", SupportUnknown}, | ||
{"some other", SupportUndefined}, | ||
} | ||
|
||
for _, test := range tests { | ||
var support Support | ||
actual := support.Parse(test.in) | ||
|
||
assert.Equal(t, test.expected, support) | ||
assert.Equal(t, test.expected, actual) | ||
} | ||
} |