Skip to content

Commit

Permalink
implement windows
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Aug 22, 2023
1 parent 514ac9e commit ceb60f1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions jfuse-win/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<includeConstant>ERANGE</includeConstant>
<includeConstant>ENOLCK</includeConstant>
<includeConstant>ENAMETOOLONG</includeConstant>
<includeConstant>ENODATA</includeConstant>
</includeConstants>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ public int enolck() {
public int enametoolong() {
return errno_h.ENAMETOOLONG();
}

@Override
public int enodata() {
return errno_h.ENODATA();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static int EINVAL() {
public static int ERANGE() {
return (int)34L;
}
/**
* {@snippet :
* #define ENODATA 120
* }
*/
public static int ENODATA() {
return (int)120L;
}
/**
* {@snippet :
* #define ENOTSUP 129
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package org.cryptomator.jfuse.win;

import org.cryptomator.jfuse.api.Errno;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

public class WinErrnoTest {

@DisplayName("make sure method is not a stub")
@DisplayName("make sure errno method is not a stub")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException {
@MethodSource("errnoNameProvider")
public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException {
var errno = new WinErrno();
var method = WinErrno.class.getMethod(methodName);

Expand All @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce
Assertions.assertNotEquals(0, result);
}

static Stream<String> errnoNameProvider() {
return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName);
}

}

0 comments on commit ceb60f1

Please sign in to comment.