Skip to content

Commit

Permalink
Convert error tests to cram tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Jan 12, 2024
1 parent 705625a commit e8d38a8
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/unit/pure/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
(cram
(deps
version.exe
error.exe
))

(executables
(names
version
error
)
(libraries luv))
87 changes: 87 additions & 0 deletions test/unit/pure/error.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
let () =
List.iter (fun error ->
Printf.printf "%-20s %s\n"
(Luv.Error.err_name error) (Luv.Error.strerror error))
[
`E2BIG;
`EACCES;
`EADDRINUSE;
`EADDRNOTAVAIL;
`EAFNOSUPPORT;
`EAGAIN;
`EAI_ADDRFAMILY;
`EAI_AGAIN;
`EAI_BADFLAGS;
`EAI_BADHINTS;
`EAI_CANCELED;
`EAI_FAIL;
`EAI_FAMILY;
`EAI_MEMORY;
`EAI_NODATA;
`EAI_NONAME;
`EAI_OVERFLOW;
`EAI_PROTOCOL;
`EAI_SERVICE;
`EAI_SOCKTYPE;
`EALREADY;
`EBADF;
`EBUSY;
`ECANCELED;
`ECONNABORTED;
`ECONNREFUSED;
`ECONNRESET;
`EDESTADDRREQ;
`EEXIST;
`EFAULT;
`EFBIG;
`EFTYPE;
`EHOSTUNREACH;
`EILSEQ;
`EINTR;
`EINVAL;
`EIO;
`EISCONN;
`EISDIR;
`ELOOP;
`EMFILE;
`EMLINK;
`EMSGSIZE;
`ENAMETOOLONG;
`ENETDOWN;
`ENETUNREACH;
`ENFILE;
`ENOBUFS;
`ENODATA;
`ENODEV;
`ENOENT;
`ENOMEM;
`ENONET;
`ENOPROTOOPT;
`ENOSPC;
`ENOSYS;
`ENOTCONN;
`ENOTDIR;
`ENOTEMPTY;
`ENOTSOCK;
`ENOTSUP;
`ENOTTY;
`ENXIO;
`EOF;
`EOVERFLOW;
`EPERM;
`EPIPE;
`EPROTO;
`EPROTONOSUPPORT;
`EPROTOTYPE;
`ERANGE;
`EROFS;
`ESHUTDOWN;
`ESOCKTNOSUPPORT;
`ESPIPE;
`ESRCH;
`ETIMEDOUT;
`ETXTBSY;
`EUNATCH;
`EXDEV;
`UNKNOWN;
]
83 changes: 83 additions & 0 deletions test/unit/pure/pure.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,86 @@
version (): 0x012F00
is_release: true
suffix: ""

$ dune exec ./error.exe
E2BIG argument list too long
EACCES permission denied
EADDRINUSE address already in use
EADDRNOTAVAIL address not available
EAFNOSUPPORT address family not supported
EAGAIN resource temporarily unavailable
EAI_ADDRFAMILY address family not supported
EAI_AGAIN temporary failure
EAI_BADFLAGS bad ai_flags value
EAI_BADHINTS invalid value for hints
EAI_CANCELED request canceled
EAI_FAIL permanent failure
EAI_FAMILY ai_family not supported
EAI_MEMORY out of memory
EAI_NODATA no address
EAI_NONAME unknown node or service
EAI_OVERFLOW argument buffer overflow
EAI_PROTOCOL resolved protocol is unknown
EAI_SERVICE service not available for socket type
EAI_SOCKTYPE socket type not supported
EALREADY connection already in progress
EBADF bad file descriptor
EBUSY resource busy or locked
ECANCELED operation canceled
ECONNABORTED software caused connection abort
ECONNREFUSED connection refused
ECONNRESET connection reset by peer
EDESTADDRREQ destination address required
EEXIST file already exists
EFAULT bad address in system call argument
EFBIG file too large
EFTYPE inappropriate file type or format
EHOSTUNREACH host is unreachable
EILSEQ illegal byte sequence
EINTR interrupted system call
EINVAL invalid argument
EIO i/o error
EISCONN socket is already connected
EISDIR illegal operation on a directory
ELOOP too many symbolic links encountered
EMFILE too many open files
EMLINK too many links
EMSGSIZE message too long
ENAMETOOLONG name too long
ENETDOWN network is down
ENETUNREACH network is unreachable
ENFILE file table overflow
ENOBUFS no buffer space available
ENODATA no data available
ENODEV no such device
ENOENT no such file or directory
ENOMEM not enough memory
ENONET machine is not on the network
ENOPROTOOPT protocol not available
ENOSPC no space left on device
ENOSYS function not implemented
ENOTCONN socket is not connected
ENOTDIR not a directory
ENOTEMPTY directory not empty
ENOTSOCK socket operation on non-socket
ENOTSUP operation not supported on socket
ENOTTY inappropriate ioctl for device
ENXIO no such device or address
EOF end of file
EOVERFLOW value too large for defined data type
EPERM operation not permitted
EPIPE broken pipe
EPROTO protocol error
EPROTONOSUPPORT protocol not supported
EPROTOTYPE protocol wrong type for socket
ERANGE result too large
EROFS read-only file system
ESHUTDOWN cannot send after transport endpoint shutdown
ESOCKTNOSUPPORT socket type not supported
ESPIPE invalid seek
ESRCH no such process
ETIMEDOUT connection timed out
ETXTBSY text file is busy
EUNATCH protocol driver not attached
EXDEV cross-device link not permitted
UNKNOWN unknown error

0 comments on commit e8d38a8

Please sign in to comment.