@@ -15,6 +15,12 @@ function setup (~)
15
15
% Test correct formatting with spaces when the tab size is 4.
16
16
% Each indent should be represented by 4 spaces.
17
17
function testFormatting4WithSpaces (testCase )
18
+ if shouldSkipTest()
19
+ disp(' Skipping test due to environment limitations.' );
20
+ testCase .verifyTrue(true );
21
+ return ;
22
+ end
23
+
18
24
options.insertSpaces = true ;
19
25
options.tabSize = 4 ;
20
26
@@ -27,6 +33,12 @@ function testFormatting4WithSpaces (testCase)
27
33
% Test correct formatting with tabs when the tab size is 4.
28
34
% Each indent should be represented by 1 tab character.
29
35
function testFormatting4WithTabs (testCase )
36
+ if shouldSkipTest()
37
+ disp(' Skipping test due to environment limitations.' );
38
+ testCase .verifyTrue(true );
39
+ return ;
40
+ end
41
+
30
42
options.insertSpaces = false ;
31
43
options.tabSize = 4 ;
32
44
@@ -39,6 +51,12 @@ function testFormatting4WithTabs (testCase)
39
51
% Test correct formatting with spaces when the tab size is 6.
40
52
% Each indent should be represented by 6 spaces.
41
53
function testFormatting6WithSpaces (testCase )
54
+ if shouldSkipTest()
55
+ disp(' Skipping test due to environment limitations.' );
56
+ testCase .verifyTrue(true );
57
+ return ;
58
+ end
59
+
42
60
options.insertSpaces = true ;
43
61
options.tabSize = 6 ;
44
62
@@ -51,6 +69,12 @@ function testFormatting6WithSpaces (testCase)
51
69
% Test correct formatting with tabs when the tab size is 6.
52
70
% Each indent should be represented by 1 tab character.
53
71
function testFormatting6WithTabs (testCase )
72
+ if shouldSkipTest()
73
+ disp(' Skipping test due to environment limitations.' );
74
+ testCase .verifyTrue(true );
75
+ return ;
76
+ end
77
+
54
78
options.insertSpaces = false ;
55
79
options.tabSize = 4 ;
56
80
@@ -61,3 +85,9 @@ function testFormatting6WithTabs (testCase)
61
85
end
62
86
end
63
87
end
88
+
89
+ function shouldSkip = shouldSkipTest ()
90
+ % Before 25a, code formatting depends on Java logic, which may not be available
91
+ % in the testing environment.
92
+ shouldSkip = isMATLABReleaseOlderThan(' R2025a' ) && ~isempty(javachk(' swing' ));
93
+ end
0 commit comments