Skip to content

Commit 944829e

Browse files
committed
fix compile errors
1 parent 45a316c commit 944829e

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

pkg/demoinfocs/common/player_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,17 +448,6 @@ func TestPlayer_MVPs(t *testing.T) {
448448
assert.Equal(t, 4, pl.MVPs())
449449
}
450450

451-
func TestPlayer_ResourceEntity(t *testing.T) {
452-
resourceEntity := entityWithID(1)
453-
pl := &Player{
454-
demoInfoProvider: demoInfoProviderMock{
455-
playerResourceEntity: resourceEntity,
456-
},
457-
}
458-
459-
assert.Same(t, resourceEntity, pl.ResourceEntity())
460-
}
461-
462451
func TestPlayer_SteamID32(t *testing.T) {
463452
pl := &Player{SteamID64: 76561198012952267}
464453

pkg/demoinfocs/fake/game_rules.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/stretchr/testify/mock"
77

88
demoinfocs "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs"
9+
st "github.com/markus-wa/demoinfocs-golang/v2/pkg/demoinfocs/sendtables"
910
)
1011

1112
var _ demoinfocs.GameRules = new(GameRules)
@@ -15,6 +16,10 @@ type GameRules struct {
1516
mock.Mock
1617
}
1718

19+
func (gr *GameRules) Entity() st.Entity {
20+
return gr.Called().Get(0).(st.Entity)
21+
}
22+
1823
// BombTime is a mock-implementation of GameRules.BombTime().
1924
func (gr *GameRules) BombTime() (time.Duration, error) {
2025
return gr.Called().Get(0).(time.Duration), gr.Called().Get(0).(error)

pkg/demoinfocs/fake/game_state.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,12 @@ func (gs *GameState) IsMatchStarted() bool {
8585
return gs.Called().Bool(0)
8686
}
8787

88-
// ConVars is a mock-implementation of GameState.ConVars().
89-
func (gs *GameState) ConVars() map[string]string {
90-
return gs.Called().Get(0).(map[string]string)
91-
}
92-
9388
// Rules is a mock-implementation of GameState.Rules().
9489
func (gs *GameState) Rules() demoinfocs.GameRules {
9590
return gs.Called().Get(0).(demoinfocs.GameRules)
9691
}
9792

98-
// PlayerResorceEntity is a mock-implementation of GameState.PlayerResorceEntity().
93+
// PlayerResourceEntity is a mock-implementation of GameState.PlayerResorceEntity().
9994
func (gs *GameState) PlayerResourceEntity() st.Entity {
10095
return gs.Called().Get(0).(st.Entity)
10196
}

pkg/demoinfocs/game_state_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,13 @@ func TestParticipants_SpottedBy(t *testing.T) {
278278
assert.ElementsMatch(t, []*common.Player{spotted1, spotted2}, spotted)
279279
}
280280

281-
func TestGameRules_ConVars(t *testing.T) {
282-
cvars := make(map[string]string)
283-
gr := gameRules{conVars: cvars}
284-
285-
assert.Equal(t, cvars, gr.ConVars())
281+
func TestGameRules_Entity(t *testing.T) {
282+
ent := stfake.NewEntityWithProperty("m_iGameMode", st.PropertyValue{IntVal: 1})
283+
gr := gameRules{
284+
entity: ent,
285+
}
286286

287-
gs := gameState{rules: gr}
288-
assert.Equal(t, cvars, gs.ConVars())
287+
assert.Equal(t, ent, gr.Entity())
289288
}
290289

291290
func TestGameRules_BombTime(t *testing.T) {

0 commit comments

Comments
 (0)