Skip to content

Commit

Permalink
test: assume that java available where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jan 1, 2024
1 parent 9182764 commit ef94843
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion +stdlib/+test/TestFileImpure.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

function test_expanduser(tc)
import stdlib.expanduser
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(expanduser(string.empty))
tc.verifyEqual(expanduser(""), "")
Expand All @@ -23,7 +24,7 @@ function test_makedir(tc)

function test_samepath(tc)
import stdlib.fileio.samepath
tc.assumeTrue(usejava("jvm"), "Java required for samepath")
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(samepath(string.empty, string.empty))
tc.verifyTrue(samepath("", ""))
Expand All @@ -34,6 +35,7 @@ function test_samepath(tc)


function test_which_name(tc)
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(stdlib.which(tempname))

Expand All @@ -51,6 +53,7 @@ function test_which_name(tc)

function test_is_exe_which_fullpath(tc)
import matlab.unittest.constraints.IsFile
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(stdlib.is_exe(string.empty))
tc.verifyFalse(stdlib.is_exe(""))
Expand Down Expand Up @@ -80,6 +83,7 @@ function test_is_exe_which_fullpath(tc)
function test_hash(tc)
import matlab.unittest.constraints.IsFile
import matlab.unittest.fixtures.TemporaryFolderFixture
tc.assumeTrue(usejava("jvm"), "Java required")

fixture = tc.applyFixture(TemporaryFolderFixture);

Expand Down
8 changes: 3 additions & 5 deletions +stdlib/+test/TestFilePure.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function test_path_tail(tc)
function test_is_absolute_path(tc)

import stdlib.is_absolute_path
% path need not exist
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(is_absolute_path(string.empty))
tc.verifyFalse(is_absolute_path(""))
Expand All @@ -52,8 +52,7 @@ function test_is_absolute_path(tc)
function test_absolute_path(tc)

import stdlib.absolute_path

tc.assumeTrue(usejava("jvm"), "Java required for absolute_path")
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(absolute_path(string.empty))
tc.verifyEqual(absolute_path(""), string(pwd))
Expand Down Expand Up @@ -83,8 +82,7 @@ function test_absolute_path(tc)
function test_canonical(tc)

import stdlib.canonical

tc.assumeTrue(usejava("jvm"), "Java required for absolute_path")
tc.assumeTrue(usejava("jvm"), "Java required")

tc.verifyEmpty(canonical(string.empty))
tc.verifyEqual(canonical(""), string(pwd))
Expand Down
2 changes: 1 addition & 1 deletion +stdlib/+test/TestIntg.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test_checkRAM(tc)
end

function test_diskfree(tc)
tc.assumeTrue(usejava("jvm"), "Java required for path_tail")
tc.assumeTrue(usejava("jvm"), "Java required")

tc.assertTrue(isnumeric(stdlib.sys.diskfree('/')))
tc.assertTrue(stdlib.sys.diskfree('/') > 0, 'diskfree')
Expand Down
3 changes: 3 additions & 0 deletions +stdlib/+test/TestSys.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
methods (Test)

function test_simple_run(tc)
tc.assumeTrue(usejava("jvm"), "Java required")

if ispc
c = 'dir';
Expand All @@ -18,6 +19,7 @@ function test_simple_run(tc)


function test_env_run(tc)
tc.assumeTrue(usejava("jvm"), "Java required")

names = ["TEST1", "TEST2"];
vals = ["test123", "test321"];
Expand All @@ -41,6 +43,7 @@ function test_env_run(tc)
end

function test_find_fortran(tc)
tc.assumeTrue(usejava("jvm"), "Java required")
tc.verifyTrue(isstring(stdlib.sys.find_fortran_compiler()))
end

Expand Down

0 comments on commit ef94843

Please sign in to comment.