@@ -122,30 +122,30 @@ func Test_Last(t *testing.T) {
122122
123123func Test_Get (t * testing.T ) {
124124 // 正索引
125- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (0 )); got != "1" {
125+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (0 )); got != "1" {
126126 t .Errorf ("Get() = %v, want %v" , got , "1" )
127127 }
128- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (1 )); got != "2" {
128+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (1 )); got != "2" {
129129 t .Errorf ("Get() = %v, want %v" , got , "2" )
130130 }
131- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (2 )); got != "3" {
131+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (2 )); got != "3" {
132132 t .Errorf ("Get() = %v, want %v" , got , "3" )
133133 }
134- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (3 )); got != "4" {
134+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (3 )); got != "4" {
135135 t .Errorf ("Get() = %v, want %v" , got , "4" )
136136 }
137137
138138 // 负索引
139- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (- 1 )); got != "4" {
139+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (- 1 )); got != "4" {
140140 t .Errorf ("Get() = %v, want %v" , got , "4" )
141141 }
142- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (- 2 )); got != "3" {
142+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (- 2 )); got != "3" {
143143 t .Errorf ("Get() = %v, want %v" , got , "3" )
144144 }
145- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (- 3 )); got != "2" {
145+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (- 3 )); got != "2" {
146146 t .Errorf ("Get() = %v, want %v" , got , "2" )
147147 }
148- if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).GetWithBool (- 4 )); got != "1" {
148+ if got := must .TakeOneDiscardBool (New [string ]().RPush ("1" , "2" , "3" , "4" ).TryGet (- 4 )); got != "1" {
149149 t .Errorf ("Get() = %v, want %v" , got , "1" )
150150 }
151151}
0 commit comments