Skip to content

Commit

Permalink
fixup! CP-47001: [xapi-fdcaps]: add properties module and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edwintorok committed Dec 21, 2023
1 parent 270aea6 commit d564f41
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions lib/xapi-fdcaps/test/properties.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,48 @@ Check that we get compile errors when trying to use a read-only or write-only pr

$ cat >t.ml <<'EOF'
> open Xapi_fdcaps.Properties
> let _ = as_readable (make `wronly `reg) in ()
> let _ = as_readable (make `wronly `reg)
> EOF
$ ocamlfind ocamlc -package xapi-fdcaps -c t.ml
File "t.ml", line 2, characters 40-42:
2 | let _ = as_readable (make `wronly `reg) in ()
^^
Error: Syntax error
File "t.ml", line 2, characters 20-39:
2 | let _ = as_readable (make `wronly `reg)
^^^^^^^^^^^^^^^^^^^
Error: This expression has type
([< Xapi_fdcaps.Properties.rw > `wronly ] as 'a,
[< Xapi_fdcaps.Properties.kind > `reg ] as 'b)
Xapi_fdcaps.Properties.t = ('a, 'b) Xapi_fdcaps.Properties.props
but an expression was expected of type
([< Xapi_fdcaps.Properties.readable ] as 'c,
[< Xapi_fdcaps.Properties.kind ] as 'd)
Xapi_fdcaps.Properties.t = ('c, 'd) Xapi_fdcaps.Properties.props
Type
[< Xapi_fdcaps.Properties.rw > `wronly ] =
[< `rdonly | `rdwr | `wronly > `wronly ]
is not compatible with type
[< Xapi_fdcaps.Properties.readable ] = [< `rdonly | `rdwr ]
The second variant type does not allow tag(s) `wronly
[2]

$ cat >t.ml <<'EOF'
> open Xapi_fdcaps.Properties
> let _ = as_writable (make `rdonly `reg) in ()
> let _ = as_writable (make `rdonly `reg)
> EOF
$ ocamlfind ocamlc -package xapi-fdcaps -c t.ml
File "t.ml", line 2, characters 40-42:
2 | let _ = as_writable (make `rdonly `reg) in ()
^^
Error: Syntax error
File "t.ml", line 2, characters 20-39:
2 | let _ = as_writable (make `rdonly `reg)
^^^^^^^^^^^^^^^^^^^
Error: This expression has type
([< Xapi_fdcaps.Properties.rw > `rdonly ] as 'a,
[< Xapi_fdcaps.Properties.kind > `reg ] as 'b)
Xapi_fdcaps.Properties.t = ('a, 'b) Xapi_fdcaps.Properties.props
but an expression was expected of type
([< Xapi_fdcaps.Properties.writable ] as 'c,
[< Xapi_fdcaps.Properties.kind ] as 'd)
Xapi_fdcaps.Properties.t = ('c, 'd) Xapi_fdcaps.Properties.props
Type
[< Xapi_fdcaps.Properties.rw > `rdonly ] =
[< `rdonly | `rdwr | `wronly > `rdonly ]
is not compatible with type
[< Xapi_fdcaps.Properties.writable ] = [< `rdwr | `wronly ]
The second variant type does not allow tag(s) `rdonly
[2]

0 comments on commit d564f41

Please sign in to comment.