@@ -15,6 +15,12 @@ function setup (~)
1515 % Test correct formatting with spaces when the tab size is 4.
1616 % Each indent should be represented by 4 spaces.
1717 function testFormatting4WithSpaces (testCase )
18+ if shouldSkipTest()
19+ disp(' Skipping test due to environment limitations.' );
20+ testCase .verifyTrue(true );
21+ return ;
22+ end
23+
1824 options.insertSpaces = true ;
1925 options.tabSize = 4 ;
2026
@@ -27,6 +33,12 @@ function testFormatting4WithSpaces (testCase)
2733 % Test correct formatting with tabs when the tab size is 4.
2834 % Each indent should be represented by 1 tab character.
2935 function testFormatting4WithTabs (testCase )
36+ if shouldSkipTest()
37+ disp(' Skipping test due to environment limitations.' );
38+ testCase .verifyTrue(true );
39+ return ;
40+ end
41+
3042 options.insertSpaces = false ;
3143 options.tabSize = 4 ;
3244
@@ -39,6 +51,12 @@ function testFormatting4WithTabs (testCase)
3951 % Test correct formatting with spaces when the tab size is 6.
4052 % Each indent should be represented by 6 spaces.
4153 function testFormatting6WithSpaces (testCase )
54+ if shouldSkipTest()
55+ disp(' Skipping test due to environment limitations.' );
56+ testCase .verifyTrue(true );
57+ return ;
58+ end
59+
4260 options.insertSpaces = true ;
4361 options.tabSize = 6 ;
4462
@@ -51,6 +69,12 @@ function testFormatting6WithSpaces (testCase)
5169 % Test correct formatting with tabs when the tab size is 6.
5270 % Each indent should be represented by 1 tab character.
5371 function testFormatting6WithTabs (testCase )
72+ if shouldSkipTest()
73+ disp(' Skipping test due to environment limitations.' );
74+ testCase .verifyTrue(true );
75+ return ;
76+ end
77+
5478 options.insertSpaces = false ;
5579 options.tabSize = 4 ;
5680
@@ -61,3 +85,9 @@ function testFormatting6WithTabs (testCase)
6185 end
6286 end
6387end
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