-
Notifications
You must be signed in to change notification settings - Fork 58
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
3 changed files
with
75 additions
and
62 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true |
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,6 @@ | ||
*.go text eol=lf | ||
.editorconfig text eol=lf | ||
LICENSE text eol=lf | ||
Makefile text eol=lf | ||
*.MD text eol=lf | ||
*.travis.yml text eol=lf |
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,62 +1,62 @@ | ||
package twitch | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func assertStringsEqual(t *testing.T, expected, actual string) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%s\" is expected \"%s\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertIntsEqual(t *testing.T, expected, actual int) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%d\" is expected \"%d\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertInt32sEqual(t *testing.T, expected, actual int32) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%d\" is expected \"%d\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertTrue(t *testing.T, actual bool, errorMessage string) { | ||
if !actual { | ||
t.Error(errorMessage) | ||
} | ||
} | ||
|
||
func assertFalse(t *testing.T, actual bool, errorMessage string) { | ||
if actual { | ||
t.Error(errorMessage) | ||
} | ||
} | ||
|
||
func assertStringSlicesEqual(t *testing.T, expected, actual []string) { | ||
if actual == nil { | ||
t.Errorf("actual slice was nil") | ||
} | ||
|
||
if len(actual) != len(expected) { | ||
t.Errorf("actual slice was not the same length as expected slice") | ||
} | ||
|
||
for i, v := range actual { | ||
if v != expected[i] { | ||
t.Errorf("actual slice value \"%s\" was not equal to expected value \"%s\" at index \"%d\"", v, expected[i], i) | ||
} | ||
} | ||
} | ||
|
||
func assertErrorsEqual(t *testing.T, expected, actual error) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that error \"%s\" is expected \"%s\"", actual, expected) | ||
} | ||
} | ||
|
||
// formats a ping-signature (i.e. go-twitch-irc) into a full-fledged pong response (i.e. ":tmi.twitch.tv PONG tmi.twitch.tv :go-twitch-irc") | ||
func formatPong(signature string) string { | ||
return ":tmi.twitch.tv PONG tmi.twitch.tv :" + signature | ||
} | ||
package twitch | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func assertStringsEqual(t *testing.T, expected, actual string) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%s\" is expected \"%s\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertIntsEqual(t *testing.T, expected, actual int) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%d\" is expected \"%d\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertInt32sEqual(t *testing.T, expected, actual int32) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that \"%d\" is expected \"%d\"", actual, expected) | ||
} | ||
} | ||
|
||
func assertTrue(t *testing.T, actual bool, errorMessage string) { | ||
if !actual { | ||
t.Error(errorMessage) | ||
} | ||
} | ||
|
||
func assertFalse(t *testing.T, actual bool, errorMessage string) { | ||
if actual { | ||
t.Error(errorMessage) | ||
} | ||
} | ||
|
||
func assertStringSlicesEqual(t *testing.T, expected, actual []string) { | ||
if actual == nil { | ||
t.Errorf("actual slice was nil") | ||
} | ||
|
||
if len(actual) != len(expected) { | ||
t.Errorf("actual slice was not the same length as expected slice") | ||
} | ||
|
||
for i, v := range actual { | ||
if v != expected[i] { | ||
t.Errorf("actual slice value \"%s\" was not equal to expected value \"%s\" at index \"%d\"", v, expected[i], i) | ||
} | ||
} | ||
} | ||
|
||
func assertErrorsEqual(t *testing.T, expected, actual error) { | ||
if expected != actual { | ||
t.Errorf("failed asserting that error \"%s\" is expected \"%s\"", actual, expected) | ||
} | ||
} | ||
|
||
// formats a ping-signature (i.e. go-twitch-irc) into a full-fledged pong response (i.e. ":tmi.twitch.tv PONG tmi.twitch.tv :go-twitch-irc") | ||
func formatPong(signature string) string { | ||
return ":tmi.twitch.tv PONG tmi.twitch.tv :" + signature | ||
} |