mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(channelserver): consolidate tests into matching source test files
Move ~300 test functions from 21 catch-all files (handlers_core_test.go, handlers_coverage*_test.go, *_coverage_test.go) into the *_test.go file matching each handler's source file. This makes tests discoverable by convention: tests for handlers_guild.go live in handlers_guild_test.go. New files: handlers_guild_mission_test.go, sys_time_test.go. No test logic changed — pure file reorganization.
This commit is contained in:
@@ -369,3 +369,60 @@ func TestObjectHandlers_SequentialPositionUpdate(t *testing.T) {
|
||||
obj.x, obj.y, obj.z)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests consolidated from handlers_coverage3_test.go
|
||||
|
||||
func TestEmptyHandlers_ObjectGo(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
fn func()
|
||||
}{
|
||||
{"handleMsgSysDeleteObject", func() { handleMsgSysDeleteObject(session, nil) }},
|
||||
{"handleMsgSysRotateObject", func() { handleMsgSysRotateObject(session, nil) }},
|
||||
{"handleMsgSysDuplicateObject", func() { handleMsgSysDuplicateObject(session, nil) }},
|
||||
{"handleMsgSysGetObjectBinary", func() { handleMsgSysGetObjectBinary(session, nil) }},
|
||||
{"handleMsgSysGetObjectOwner", func() { handleMsgSysGetObjectOwner(session, nil) }},
|
||||
{"handleMsgSysUpdateObjectBinary", func() { handleMsgSysUpdateObjectBinary(session, nil) }},
|
||||
{"handleMsgSysCleanupObject", func() { handleMsgSysCleanupObject(session, nil) }},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("%s panicked: %v", tt.name, r)
|
||||
}
|
||||
}()
|
||||
tt.fn()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyHandlers_MiscFiles_Object(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
fn func()
|
||||
}{
|
||||
{"handleMsgSysAddObject", func() { handleMsgSysAddObject(session, nil) }},
|
||||
{"handleMsgSysDelObject", func() { handleMsgSysDelObject(session, nil) }},
|
||||
{"handleMsgSysDispObject", func() { handleMsgSysDispObject(session, nil) }},
|
||||
{"handleMsgSysHideObject", func() { handleMsgSysHideObject(session, nil) }},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("%s panicked: %v", tt.name, r)
|
||||
}
|
||||
}()
|
||||
tt.fn()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user