22package crud
33
44import (
5- "github.com/tarantool/go-option"
65 "testing"
6+
7+ "github.com/tarantool/go-option"
78)
89
9- // TestOptionTypesCompilation проверяет что все типы option компилируются правильно
10+ // TestOptionTypesCompilation verifies that all option types are compiled correctly.
1011func TestOptionTypesCompilation (t * testing.T ) {
1112 // Test BaseOpts
1213 baseOpts := BaseOpts {
1314 Timeout : option .SomeFloat64 (1.5 ),
1415 VshardRouter : option .SomeString ("router" ),
1516 }
1617
17- // Проверяем что Get() работает
18+ // Check that Get() is working.
1819 if timeout , exists := baseOpts .Timeout .Get (); ! exists || timeout != 1.5 {
1920 t .Errorf ("BaseOpts.Timeout.Get() failed" )
2021 }
2122
22- // Test SimpleOperationOpts
23+ // Test SimpleOperationOpts.
2324 simpleOpts := SimpleOperationOpts {
2425 Timeout : option .SomeFloat64 (2.0 ),
2526 VshardRouter : option .SomeString ("router2" ),
2627 Fields : MakeOptAny ([]interface {}{"field1" , "field2" }),
27- BucketId : option .SomeUint (456 ), // Теперь это правильный тип
28+ BucketId : option .SomeUint (456 ),
2829 FetchLatestMetadata : option .SomeBool (true ),
2930 Noreturn : option .SomeBool (false ),
3031 }
3132
32- // Проверяем все поля
3333 if bucket , exists := simpleOpts .BucketId .Get (); ! exists || bucket != 456 {
3434 t .Errorf ("BucketId.Get() failed: got %v, %v" , bucket , exists )
3535 }
@@ -40,7 +40,7 @@ func TestOptionTypesCompilation(t *testing.T) {
4040 t .Logf ("Fields: %v" , fields )
4141 }
4242
43- // Test OperationManyOpts
43+ // Test OperationManyOpts.
4444 manyOpts := OperationManyOpts {
4545 Timeout : option .SomeFloat64 (3.0 ),
4646 StopOnError : option .SomeBool (true ),
@@ -51,9 +51,9 @@ func TestOptionTypesCompilation(t *testing.T) {
5151 }
5252}
5353
54- // TestMakeOptAny проверяет работу MakeOptAny (замена MakeOptTuple)
54+ // TestMakeOptAny checks the operation of MakeOptAny (replacing MakeOptTuple).
5555func TestMakeOptAny (t * testing.T ) {
56- // Test с простыми типами данных
56+ // Test with simple data types.
5757 testCases := []struct {
5858 name string
5959 value interface {}
@@ -84,7 +84,7 @@ func TestMakeOptAny(t *testing.T) {
8484 })
8585 }
8686
87- // Test со срезом - проверяем без сравнения значений
87+ // Test with a slice - we check without comparing the values.
8888 t .Run ("slice" , func (t * testing.T ) {
8989 sliceValue := []interface {}{"id" , "name" }
9090 opt := MakeOptAny (sliceValue )
@@ -94,7 +94,7 @@ func TestMakeOptAny(t *testing.T) {
9494 t .Errorf ("Expected value for slice, but got none" )
9595 }
9696
97- // Проверяем тип и длину вместо прямого сравнения
97+ // We check the type and length instead of direct comparison.
9898 if valSlice , ok := val .([]interface {}); ! ok {
9999 t .Errorf ("Expected slice type, got %T" , val )
100100 } else if len (valSlice ) != 2 {
0 commit comments