Skip to content

Commit ce8c7f0

Browse files
committed
fix some tests in CI
1 parent 0cda77c commit ce8c7f0

File tree

4 files changed

+50
-6
lines changed

4 files changed

+50
-6
lines changed

manualTests/test_createJson.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function test_createJsonExtra()
4242

4343
% data to test against
4444
expectedStruct = bids.util.jsondecode( ...
45-
fullfile(pwd, 'testData', 'extra_bold.json'));
45+
fullfile(pwd, '..', 'tests', 'testData', 'extra_bold.json'));
4646

4747
% test
4848
assertEqual(expectedStruct, actualStruct);

manualTests/test_createDataDictionary.m renamed to tests/test_createDataDictionary.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function test_createDataDictionaryBasic()
1010

11-
outputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'output');
11+
outputDir = fullfile(fileparts(mfilename('fullpath')), 'output');
1212

1313
%% set up
1414

@@ -59,7 +59,7 @@ function test_createDataDictionaryBasic()
5959
% data to test against
6060
expectedStruct = bids.util.jsondecode( ...
6161
fullfile( ...
62-
pwd, ...
62+
pwd, '..', 'tests', ...
6363
'testData', ...
6464
'eventsDataDictionary.json'));
6565

@@ -70,7 +70,7 @@ function test_createDataDictionaryBasic()
7070

7171
function test_createDataDictionaryStim()
7272

73-
outputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'output');
73+
outputDir = fullfile(fileparts(mfilename('fullpath')), 'output');
7474

7575
%% set up
7676

@@ -125,7 +125,7 @@ function test_createDataDictionaryStim()
125125
% data to test against
126126
expectedStruct = bids.util.jsondecode( ...
127127
fullfile( ...
128-
pwd, ...
128+
pwd, '..', 'tests', ...
129129
'testData', ...
130130
'stimDataDictionary.json'));
131131

manualTests/test_createDatasetDescription.m renamed to tests/test_createDatasetDescription.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function test_createDatasetDescriptionBasic()
1010

11-
outputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'output');
11+
outputDir = fullfile(fileparts(mfilename('fullpath')), 'output');
1212

1313
%% set up
1414

tests/test_createJson.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,50 @@ function test_createJsonIeeg()
126126

127127
end
128128

129+
function test_createJsonExtra()
130+
131+
outputDir = fullfile(fileparts(mfilename('fullpath')), 'output');
132+
133+
%% set up
134+
135+
cfg.verbose = false;
136+
137+
cfg.subject.subjectNb = 1;
138+
cfg.subject.runNb = 1;
139+
140+
cfg.task.name = 'testtask';
141+
142+
cfg.dir.output = outputDir;
143+
144+
cfg.testingDevice = 'mri';
145+
146+
cfg = createFilename(cfg);
147+
148+
logFile = saveEventsFile('init', cfg); %#ok<*NASGU>
149+
150+
extraInfo = struct('extraInfo', struct('nestedExtraInfo', 'something extra'));
151+
152+
createJson(cfg, extraInfo);
153+
154+
%% check content
155+
fileName = strrep(cfg.fileName.events, '_events', '_bold');
156+
fileName = strrep(fileName, '.tsv', '.json');
157+
158+
actualStruct = bids.util.jsondecode(fullfile( ...
159+
cfg.dir.outputSubject, ...
160+
cfg.fileName.modality, ...
161+
fileName));
162+
163+
% data to test against
164+
expectedStruct = bids.util.jsondecode( ...
165+
fullfile(pwd, '..', 'tests', 'testData', 'extra_bold.json'));
166+
167+
% test
168+
assertEqual(expectedStruct, actualStruct);
169+
170+
end
171+
172+
129173
function cfg = setUp()
130174

131175
cfg.verbose = false;

0 commit comments

Comments
 (0)