Skip to content

Commit

Permalink
Merge da577b3 into 5aa8422
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Jan 31, 2019
2 parents 5aa8422 + da577b3 commit ad220ed
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 62 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
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
6 changes: 6 additions & 0 deletions .gitattributes
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
124 changes: 62 additions & 62 deletions helpers_test.go
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
}

0 comments on commit ad220ed

Please sign in to comment.