From bdc4b873d2e203ac56f6056c331aebcf5ba67da6 Mon Sep 17 00:00:00 2001
From: Federico Felici <federico.felici@epfl.ch>
Date: Thu, 30 Sep 2021 18:09:12 +0200
Subject: [PATCH] Check gdat paths again in fixture

---
 matlab/tests/check_gdatpaths.m   | 15 +++++++++++++++
 matlab/tests/test_requestnames.m |  2 +-
 matlab/tests/test_tcv_get_ids.m  |  2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 matlab/tests/check_gdatpaths.m

diff --git a/matlab/tests/check_gdatpaths.m b/matlab/tests/check_gdatpaths.m
new file mode 100644
index 00000000..e208bad4
--- /dev/null
+++ b/matlab/tests/check_gdatpaths.m
@@ -0,0 +1,15 @@
+classdef check_gdatpaths < matlab.unittest.fixtures.Fixture
+  methods
+    function setup(fixture)
+      % caller
+      oldpwd = pwd;
+      testfolder = fileparts(fullfile(mfilename('fullpath'))); % relative path w.r.t. this file
+      cd(testfolder); % go into test folder so you might not see local gdat.m
+      gdatpath = fileparts(which('gdat'));
+      cd(oldpwd);
+      fixture.assertTrue(startsWith(testfolder,gdatpath),...
+          sprintf('test folder path does not contain path of gdat: %s\n This file is in: %s\n which(''gdat''):\n Please run setpaths_gdat() to set the paths',...
+          testfolder,which('gdat')));
+    end
+  end
+end
diff --git a/matlab/tests/test_requestnames.m b/matlab/tests/test_requestnames.m
index 1839318c..3c8986c1 100644
--- a/matlab/tests/test_requestnames.m
+++ b/matlab/tests/test_requestnames.m
@@ -1,5 +1,5 @@
 classdef (SharedTestFixtures={...
-    check_mds}) ...
+    check_mds,check_gdatpaths}) ...
     test_requestnames < matlab.unittest.TestCase
 
   properties (Abstract)
diff --git a/matlab/tests/test_tcv_get_ids.m b/matlab/tests/test_tcv_get_ids.m
index 9ef5a240..9b306579 100644
--- a/matlab/tests/test_tcv_get_ids.m
+++ b/matlab/tests/test_tcv_get_ids.m
@@ -1,5 +1,5 @@
 classdef (SharedTestFixtures={...
-    check_mds})...
+    check_mds,check_gdatpaths})...
     test_tcv_get_ids < matlab.unittest.TestCase
 
   properties(TestParameter)
-- 
GitLab