(t *testing.T)
| 1005 | } |
| 1006 | } |
| 1007 | func TestNewZSetStructure(t *testing.T) { |
| 1008 | tt := []struct { |
| 1009 | name string |
| 1010 | setup func() (*ZSetStructure, error) |
| 1011 | wantErr error |
| 1012 | }{ |
| 1013 | { |
| 1014 | name: "init no error", |
| 1015 | setup: func() (*ZSetStructure, error) { |
| 1016 | opts := config.DefaultOptions |
| 1017 | dir, _ := os.MkdirTemp("", "TestZSetStructure") |
| 1018 | opts.DirPath = dir |
| 1019 | return NewZSetStructure(opts) |
| 1020 | }, |
| 1021 | wantErr: nil, |
| 1022 | }, |
| 1023 | { |
| 1024 | name: "init with error wrong path", |
| 1025 | setup: func() (*ZSetStructure, error) { |
| 1026 | opts := config.DefaultOptions |
| 1027 | opts.DirPath = "" |
| 1028 | return NewZSetStructure(opts) |
| 1029 | }, |
| 1030 | wantErr: _const.ErrOptionDirPathIsEmpty, |
| 1031 | }, |
| 1032 | } |
| 1033 | for _, tc := range tt { |
| 1034 | t.Run(tc.name, func(t *testing.T) { |
| 1035 | _, err := tc.setup() |
| 1036 | assert.Equal(t, tc.wantErr, err) |
| 1037 | }) |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | func TestZSetStructure_Keys(t *testing.T) { |
| 1042 | zset, _ := initZSetDB() |
nothing calls this directly
no test coverage detected