-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Discordgo - Discord bindings for Go | ||
// Available at https://github.com/bwmarrin/discordgo | ||
|
||
// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package discordgo | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestMember_DisplayName(t *testing.T) { | ||
Check failure on line 14 in structs_test.go GitHub Actions / lint
Check failure on line 14 in structs_test.go GitHub Actions / test (1.13)
Check failure on line 14 in structs_test.go GitHub Actions / test (1.14)
Check failure on line 14 in structs_test.go GitHub Actions / test (1.15)
Check failure on line 14 in structs_test.go GitHub Actions / test (1.16)
Check failure on line 14 in structs_test.go GitHub Actions / test (1.17)
|
||
user := &User{ | ||
GlobalName: "Global", | ||
} | ||
t.Run("no server nickname set", func(t *testing.T) { | ||
Check failure on line 18 in structs_test.go GitHub Actions / test (1.13)
Check failure on line 18 in structs_test.go GitHub Actions / test (1.14)
|
||
m := &Member{ | ||
Nick: "", | ||
User: user, | ||
} | ||
if dn := m.DisplayName(); dn != user.GlobalName { | ||
t.Errorf("Member.DisplayName() = %v, want %v", dn, user.GlobalName) | ||
} | ||
}) | ||
t.Run("server nickname set", func(t *testing.T) { | ||
Check failure on line 27 in structs_test.go GitHub Actions / test (1.13)
Check failure on line 27 in structs_test.go GitHub Actions / test (1.14)
|
||
m := &Member{ | ||
Nick: "Server", | ||
User: user, | ||
} | ||
if dn := m.DisplayName(); dn != m.Nick { | ||
t.Errorf("Member.DisplayName() = %v, want %v", dn, m.Nick) | ||
} | ||
}) | ||
} |