1
+ classdef TestDelete < Prep
2
+ % TestDelete tests delete operations.
3
+ methods (Test )
4
+ function TestDelete_testRenamedDelete(testCase )
5
+ st = dbstack ;
6
+ disp([' ---------------' st(1 ).name ' ---------------' ]);
7
+ % https://github.com/datajoint/datajoint-matlab/issues/362
8
+ dj .config(' safemode' , false );
9
+ package = ' Company' ;
10
+
11
+ c1 = dj .conn(...
12
+ testCase .CONN_INFO .host ,...
13
+ testCase .CONN_INFO .user ,...
14
+ testCase .CONN_INFO .password ,' ' ,true );
15
+
16
+ dj .createSchema(package ,[testCase .test_root ' /test_schemas' ], ...
17
+ [testCase .PREFIX ' _company' ]);
18
+
19
+ inserti(Company .Employee , {' raphael' , 2019 ; ' shan' , 2018 ; ' chris' , 2018 ; ...
20
+ ' thinh' , 2019 });
21
+ inserti(Company .Duty , {' schedule1' , ' shan' , 2018 ; ' schedule2' , ' raphael' , 2019 });
22
+ inserti(Company .Machine , {' shan' , 2018 , ' abc1023' ; ' raphael' , 2019 , ' xyz9876' });
23
+ testCase .verifyEqual(length(fetch(Company .Employee )), 4 );
24
+ testCase .verifyEqual(length(fetch(Company .Duty )), 2 );
25
+ testCase .verifyEqual(length(fetch(Company .Machine )), 2 );
26
+
27
+ del(Company .Employee & ' employee_id="shan"' );
28
+
29
+ testCase .verifyEqual(length(fetch(Company .Employee )), 3 );
30
+ testCase .verifyEqual(...
31
+ length(fetch(Company .Employee & struct(' employee_id' , ' shan' ))), 0 );
32
+ testCase .verifyEqual(length(fetch(Company .Duty )), 1 );
33
+ testCase .verifyEqual(...
34
+ length(fetch(Company .Duty & struct(' monday_on_call' , ' shan' ))), 0 );
35
+ testCase .verifyEqual(length(fetch(Company .Machine )), 1 );
36
+ testCase .verifyEqual(...
37
+ length(fetch(Company .Machine & struct(' employee_id' , ' shan' ))), 0 );
38
+ end
39
+ end
40
+ end
0 commit comments