File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11
22%% HOSTNAME get hostname of local machine
3- % requires : java
3+ % optional : java
44%
55% Ref: https://docs.oracle.com/javase/8/docs/api/java/net/InetAddress.html#getHostName--
66
77function n = hostname()
88
9- if stdlib .isoctave()
9+ if ispc()
10+ n = string(System .Environment .MachineName );
11+ elseif stdlib .isoctave()
1012 n = gethostname();
1113else
1214 n = string(java .net .InetAddress .getLocalHost().getHostName());
Original file line number Diff line number Diff line change @@ -38,11 +38,6 @@ function test_username(tc)
3838tc .verifyGreaterThan(strlength(u ), 0 )
3939end
4040
41- function test_hostname(tc )
42- h = stdlib .hostname();
43- tc .verifyGreaterThan(strlength(h ), 0 )
44- end
45-
4641function test_java_vendor(tc )
4742v = stdlib .java_vendor();
4843tc .verifyGreaterThan(strlength(v ), 0 )
Original file line number Diff line number Diff line change 99methods (Test , TestTags = " impure" )
1010
1111function test_platform_logical(tc , fun )
12-
1312tc .verifyClass(fun , ' logical' )
1413end
1514
1615function test_platform_int32(tc , fi32 )
1716tc .verifyClass(fi32 , ' int32' )
1817end
1918
19+ function test_hostname(tc )
20+ tc .assumeTrue(ispc() || stdlib .has_java())
21+ h = stdlib .hostname();
22+ tc .verifyGreaterThan(strlength(h ), 0 )
23+ end
24+
2025end
2126end
You can’t perform that action at this time.
0 commit comments