51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
desc: Tests deletes of selections
|
|
table_variable_name: tbl
|
|
tests:
|
|
|
|
# Set up some data
|
|
|
|
- py: tbl.insert([{'id':i} for i in xrange(100)])
|
|
js: |
|
|
tbl.insert(function(){
|
|
var res = []
|
|
for (var i = 0; i < 100; i++) {
|
|
res.push({id: i});
|
|
}
|
|
return res;
|
|
}())
|
|
rb: tbl.insert((1..100).map{ |i| {"id" => i} })
|
|
ot: ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':100})
|
|
|
|
- cd: tbl.count()
|
|
ot: 100
|
|
|
|
# Point delete
|
|
|
|
- cd: tbl.get(12).delete()
|
|
ot: ({'deleted':1,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0})
|
|
|
|
# Attempt deletion with bad durability flag.
|
|
|
|
- js: tbl.skip(50).delete({durability:'wrong'})
|
|
rb: tbl.skip(50).delete({ :durability => 'wrong' })
|
|
py: tbl.skip(50).delete(durability='wrong')
|
|
ot: err('ReqlQueryLogicError', 'Durability option `wrong` unrecognized (options are "hard" and "soft").', [0])
|
|
|
|
# Delete selection of table, soft durability flag.
|
|
|
|
- js: tbl.skip(50).delete({durability:'soft'})
|
|
rb: tbl.skip(50).delete({ :durability => 'soft' })
|
|
py: tbl.skip(50).delete(durability='soft')
|
|
ot: ({'deleted':49,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0})
|
|
|
|
# Delete whole table, hard durability flag.
|
|
|
|
- js: tbl.delete({durability:'hard'})
|
|
rb: tbl.delete({ :durability => 'hard' })
|
|
py: tbl.delete(durability='hard')
|
|
ot: ({'deleted':50,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0})
|
|
|
|
# test deletion on a non-deletable object
|
|
- cd: r.expr([1, 2]).delete()
|
|
ot: err('ReqlQueryLogicError', 'Expected type SELECTION but found DATUM:', [0])
|