Skip to content

Commit 82183f1

Browse files
Merge pull request #374 from datajoint/stage2
Add support for curly brackets in commments
2 parents 755ea67 + fba032d commit 82183f1

File tree

10 files changed

+44
-8
lines changed

10 files changed

+44
-8
lines changed

+dj/+internal/Declare.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ case regexp(line, ['^[a-z][a-z\d_]*\s*' ... % name
382382
end
383383
end
384384
% Escape characters: "/
385-
field.comment = regexprep(field.comment, '(["\/])', '\\\\$1');
385+
field.comment = regexprep(field.comment, '(["\/{}])', '\\\\$1');
386386

387387
category = dj.internal.Declare.matchType(field.type);
388388
store = [];

+dj/setup.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function setup(varargin)
2323
struct(...
2424
'Name', 'mym', ...
2525
'ResolveTarget', 'datajoint/mym', ...
26-
'Version', @(v) compareVersions(v, '2.8.0', @(v_actual,v_ref) v_actual>=v_ref)...
26+
'Version', @(v) compareVersions(v, '2.8.2', @(v_actual,v_ref) v_actual>=v_ref)...
2727
)...
2828
};
2929
try

+dj/version.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function varargout = version
22
% report DataJoint version
33

4-
v = struct('major',3,'minor',4,'bugfix',2);
4+
v = struct('major',3,'minor',4,'bugfix',3);
55

66
if nargout
77
varargout{1}=v;

LNX-docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
interval: 1s
3030
fakeservices.datajoint.io:
3131
<<: *net
32-
image: datajoint/nginx:v0.0.15
32+
image: datajoint/nginx:v0.0.16
3333
environment:
3434
- ADD_db_TYPE=DATABASE
3535
- ADD_db_ENDPOINT=db:3306

docs-parts/intro/Releases_lang1.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
3.4.3 -- May 28, 2021
2+
---------------------
3+
* Bugfix: Add support to curly brackets in comments (#365) PR #373
4+
15
3.4.2 -- March 16, 2021
26
--------------------------
37
* Bugfix: Fetchn with zero results throws an error (#353) PR #355

local-docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
interval: 1s
3535
fakeservices.datajoint.io:
3636
<<: *net
37-
image: raphaelguzman/nginx:v0.0.11
37+
image: datajoint/nginx:v0.0.16
3838
environment:
3939
- ADD_db_TYPE=DATABASE
4040
- ADD_db_ENDPOINT=db:3306

tests/Main.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
classdef Main < ...
22
TestConfig & ...
33
TestConnection & ...
4+
TestDeclaration & ...
45
TestERD & ...
56
TestExternalFile & ...
67
TestExternalS3 & ...
@@ -11,4 +12,4 @@
1112
TestSchema & ...
1213
TestTls & ...
1314
TestUuid
14-
end
15+
end

tests/TestDeclaration.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
classdef TestDeclaration < Prep
2+
methods (Test)
3+
%{ Function to test if a table can be inserted with curley brackets in the comments
4+
%}
5+
function TestDeclaration_testCurlyBracketComment(testCase)
6+
packageName = 'Lab';
7+
lowerPackageName = lower(packageName);
8+
% Create the connection
9+
c1 = dj.conn(...
10+
testCase.CONN_INFO.host,...
11+
testCase.CONN_INFO.user,...
12+
testCase.CONN_INFO.password, '', true);
13+
14+
% Create the schema
15+
dj.createSchema(packageName, [testCase.test_root '/test_schemas'], ...
16+
[testCase.PREFIX '_' lowerPackageName]);
17+
18+
% Initialize the table
19+
Lab.Subject
20+
21+
% Check that the comment is correct
22+
table = Lab.Subject();
23+
firstAttributeComment = table.header.attributes.comment;
24+
assert(strcmp( ...
25+
firstAttributeComment, ...
26+
'{subject_id} Comment to test curly bracket'), ...
27+
'Comment did not get inserted correctly'...
28+
);
29+
end
30+
end
31+
end

tests/TestSchema.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function TestSchema_testUnsupportedDJTypes(testCase)
3737
[testCase.PREFIX '_' lower(package)]);
3838
schema = External.getSchema;
3939
q = schema.v.Document & ['document_id=' num2str(id)];
40-
% display
40+
% display (be careful with MxPrint's b/c this test relies on stdout)
4141
queryPreview = evalc('q');
4242
queryPreview = splitlines(queryPreview);
4343
recordPreview = queryPreview(end-4);

tests/test_schemas/+Lab/Subject.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%{
22
# Subject
3-
subject_id : int
3+
subject_id : int # {subject_id} Comment to test curly bracket
44
---
55
subject_dob : date
66
unique index(subject_dob)

0 commit comments

Comments
 (0)