Skip to content

Commit c5a3d26

Browse files
authored
fix: change SpyTime receiver function name from Sleep to SetDurationSlept (#753) (#866)
1 parent 970b19e commit c5a3d26

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

mocking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ type SpyTime struct {
493493
durationSlept time.Duration
494494
}
495495

496-
func (s *SpyTime) Sleep(duration time.Duration) {
496+
func (s *SpyTime) SetDurationSlept(duration time.Duration) {
497497
s.durationSlept = duration
498498
}
499499
```
@@ -505,7 +505,7 @@ func TestConfigurableSleeper(t *testing.T) {
505505
sleepTime := 5 * time.Second
506506

507507
spyTime := &SpyTime{}
508-
sleeper := ConfigurableSleeper{sleepTime, spyTime.Sleep}
508+
sleeper := ConfigurableSleeper{sleepTime, spyTime.SetDurationSlept}
509509
sleeper.Sleep()
510510

511511
if spyTime.durationSlept != sleepTime {

mocking/v5/countdown_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestConfigurableSleeper(t *testing.T) {
4848
sleepTime := 5 * time.Second
4949

5050
spyTime := &SpyTime{}
51-
sleeper := ConfigurableSleeper{sleepTime, spyTime.Sleep}
51+
sleeper := ConfigurableSleeper{sleepTime, spyTime.SetDurationSlept}
5252
sleeper.Sleep()
5353

5454
if spyTime.durationSlept != sleepTime {
@@ -76,6 +76,6 @@ type SpyTime struct {
7676
durationSlept time.Duration
7777
}
7878

79-
func (s *SpyTime) Sleep(duration time.Duration) {
79+
func (s *SpyTime) SetDurationSlept(duration time.Duration) {
8080
s.durationSlept = duration
8181
}

mocking/v6/countdown_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestConfigurableSleeper(t *testing.T) {
4848
sleepTime := 5 * time.Second
4949

5050
spyTime := &SpyTime{}
51-
sleeper := ConfigurableSleeper{sleepTime, spyTime.Sleep}
51+
sleeper := ConfigurableSleeper{sleepTime, spyTime.SetDurationSlept}
5252
sleeper.Sleep()
5353

5454
if spyTime.durationSlept != sleepTime {
@@ -76,6 +76,6 @@ type SpyTime struct {
7676
durationSlept time.Duration
7777
}
7878

79-
func (s *SpyTime) Sleep(duration time.Duration) {
79+
func (s *SpyTime) SetDurationSlept(duration time.Duration) {
8080
s.durationSlept = duration
8181
}

0 commit comments

Comments
 (0)