Skip to content

Commit 73dba2e

Browse files
fix tests as done in cblite
1 parent 9c0f59c commit 73dba2e

File tree

6 files changed

+80
-32
lines changed

6 files changed

+80
-32
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/couchbase-lite-rust.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

logs.txt

89.9 MB
Binary file not shown.

tests/collection_tests.rs

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn create_delete_scopes_collections() {
2929
assert!(db.scope(DEFAULT_NAME.to_string()).unwrap().is_some());
3030
assert!(db.scope(unknown.clone()).unwrap().is_none());
3131
assert_eq!(
32-
db.default_scope().unwrap(),
33-
db.scope(DEFAULT_NAME.to_string()).unwrap().unwrap()
32+
db.default_scope().unwrap().name(),
33+
db.scope(DEFAULT_NAME.to_string()).unwrap().unwrap().name()
3434
);
3535

3636
// Get collection
@@ -46,10 +46,11 @@ fn create_delete_scopes_collections() {
4646
.collection(DEFAULT_NAME.to_string(), unknown.clone())
4747
.is_err()); // Invalid scope => Err
4848
assert_eq!(
49-
db.default_collection().unwrap().unwrap(),
49+
db.default_collection().unwrap().unwrap().name(),
5050
db.collection(DEFAULT_NAME.to_string(), DEFAULT_NAME.to_string())
5151
.unwrap()
5252
.unwrap()
53+
.name()
5354
);
5455

5556
// Add collection in default scope
@@ -61,13 +62,15 @@ fn create_delete_scopes_collections() {
6162
assert_eq!(
6263
db.collection(new_collection_1.clone(), DEFAULT_NAME.to_string())
6364
.unwrap()
64-
.unwrap(),
65-
c1_default_scope
65+
.unwrap()
66+
.name(),
67+
c1_default_scope.name()
6668
);
6769
assert_eq!(
6870
db.create_collection(new_collection_1.clone(), DEFAULT_NAME.to_string())
69-
.unwrap(),
70-
c1_default_scope
71+
.unwrap()
72+
.name(),
73+
c1_default_scope.name()
7174
);
7275

7376
assert_eq!(
@@ -85,13 +88,15 @@ fn create_delete_scopes_collections() {
8588
assert_eq!(
8689
db.collection(new_collection_2.clone(), new_scope.clone())
8790
.unwrap()
88-
.unwrap(),
89-
c2_new_scope
91+
.unwrap()
92+
.name(),
93+
c2_new_scope.name()
9094
);
9195
assert_eq!(
9296
db.create_collection(new_collection_2.clone(), new_scope.clone())
93-
.unwrap(),
94-
c2_new_scope
97+
.unwrap()
98+
.name(),
99+
c2_new_scope.name()
95100
);
96101

97102
assert_eq!(
@@ -158,8 +163,9 @@ fn collections_accessors() {
158163
assert_eq!(
159164
db.collection(new_collection_1.clone(), DEFAULT_NAME.to_string())
160165
.unwrap()
161-
.unwrap(),
162-
c1_default_scope
166+
.unwrap()
167+
.name(),
168+
c1_default_scope.name()
163169
);
164170

165171
let c2_new_scope = db
@@ -168,8 +174,9 @@ fn collections_accessors() {
168174
assert_eq!(
169175
db.collection(new_collection_2.clone(), new_scope.clone())
170176
.unwrap()
171-
.unwrap(),
172-
c2_new_scope
177+
.unwrap()
178+
.name(),
179+
c2_new_scope.name()
173180
);
174181

175182
let c1_new_scope = db
@@ -178,17 +185,18 @@ fn collections_accessors() {
178185
assert_eq!(
179186
db.collection(new_collection_1.clone(), new_scope.clone())
180187
.unwrap()
181-
.unwrap(),
182-
c1_new_scope
188+
.unwrap()
189+
.name(),
190+
c1_new_scope.name()
183191
);
184192

185193
let default_scope = db.scope(DEFAULT_NAME.to_string()).unwrap().unwrap();
186194
let new_actual_scope = db.scope(new_scope.clone()).unwrap().unwrap();
187195

188196
// Scope
189-
assert_eq!(c1_default_scope.scope(), default_scope);
190-
assert_eq!(c2_new_scope.scope(), new_actual_scope);
191-
assert_eq!(c1_new_scope.scope(), new_actual_scope);
197+
assert_eq!(c1_default_scope.scope().name(), default_scope.name());
198+
assert_eq!(c2_new_scope.scope().name(), new_actual_scope.name());
199+
assert_eq!(c1_new_scope.scope().name(), new_actual_scope.name());
192200

193201
// Name
194202
assert_eq!(c1_default_scope.name(), new_collection_1.clone());
@@ -216,8 +224,9 @@ fn scope_accessors() {
216224
assert_eq!(
217225
db.collection(new_collection_1.clone(), DEFAULT_NAME.to_string())
218226
.unwrap()
219-
.unwrap(),
220-
c1_default_scope
227+
.unwrap()
228+
.name(),
229+
c1_default_scope.name()
221230
);
222231

223232
let c2_new_scope = db
@@ -226,8 +235,9 @@ fn scope_accessors() {
226235
assert_eq!(
227236
db.collection(new_collection_2.clone(), new_scope.clone())
228237
.unwrap()
229-
.unwrap(),
230-
c2_new_scope
238+
.unwrap()
239+
.name(),
240+
c2_new_scope.name()
231241
);
232242

233243
let c1_new_scope = db
@@ -236,8 +246,9 @@ fn scope_accessors() {
236246
assert_eq!(
237247
db.collection(new_collection_1.clone(), new_scope.clone())
238248
.unwrap()
239-
.unwrap(),
240-
c1_new_scope
249+
.unwrap()
250+
.name(),
251+
c1_new_scope.name()
241252
);
242253

243254
let default_scope = db.scope(DEFAULT_NAME.to_string()).unwrap().unwrap();
@@ -266,22 +277,25 @@ fn scope_accessors() {
266277
default_scope
267278
.collection(new_collection_1.clone())
268279
.unwrap()
269-
.unwrap(),
270-
c1_default_scope
280+
.unwrap()
281+
.name(),
282+
c1_default_scope.name()
271283
);
272284
assert_eq!(
273285
new_actual_scope
274286
.collection(new_collection_2.clone())
275287
.unwrap()
276-
.unwrap(),
277-
c2_new_scope
288+
.unwrap()
289+
.name(),
290+
c2_new_scope.name()
278291
);
279292
assert_eq!(
280293
new_actual_scope
281294
.collection(new_collection_1.clone())
282295
.unwrap()
283-
.unwrap(),
284-
c1_new_scope
296+
.unwrap()
297+
.name(),
298+
c1_new_scope.name()
285299
);
286300
});
287301
}

0 commit comments

Comments
 (0)