Skip to content

Commit

Permalink
Core: Add first test (ref #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Vazard committed Nov 26, 2015
1 parent 214f6b6 commit 92d91a6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions core/bot_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// The MIT License (MIT)
//
// Copyright (c) 2015 Arnaud Vazard
//
// See LICENSE file.

/*
Package quote contains quote commands
*/
package core

import (
"github.com/thoj/go-ircevent"
"testing"
)

func Test_GetTargetFromEvent(t *testing.T) {

// Channel
event := irc.Event{
Nick: "Sender",
Arguments: []string{"#test_channel", "test message"}}
expectedResult := "#test_channel"

result := GetTargetFromEvent(&event)

if result != expectedResult {
t.Errorf("Result not matching expected result (%q != %q)", result, expectedResult)
}

// Nick
event = irc.Event{
Nick: "Sender",
Arguments: []string{"Receiver", "test message"}}
expectedResult = "Sender"

result = GetTargetFromEvent(&event)

if result != expectedResult {
t.Errorf("Result not matching expected result (%q != %q)", result, expectedResult)
}
}

0 comments on commit 92d91a6

Please sign in to comment.