We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests fail on x86 (32-bit arch):
[00:00:10] + /usr/bin/dune runtest -p ppx_deriving_yaml [00:00:16] (cd _build/default/test && ./test.exe) [00:00:16] Testing `ppx_deriving_yaml'. [00:00:16] This run has ID `V6YDDWAU'. [00:00:16] [00:00:16] [OK] ppx 0 test_primitives. [00:00:16] [OK] ppx 1 test_record_list. [00:00:16] [OK] ppx 2 test_tuple. [00:00:16] [OK] ppx 3 test_simple_poly. [00:00:16] [OK] ppx 4 test_var. [00:00:16] [OK] ppx 5 test_poly_variants. [00:00:16] [OK] ppx 6 test_attrib. [00:00:16] [OK] ppx 7 test_unknown. [00:00:16] [OK] ppx 8 test_recursive. [00:00:16] [00:00:16] Full test results in `~/RPM/BUILD/ocaml-ppx_deriving_yaml-0.4.0/_build/default/test/_build/_tests/ppx_deriving_yaml'. [00:00:16] Test Successful in 0.002s. 9 tests run. [00:00:18] File "src/yaml/index.mld", line 1, characters 0-0: [00:00:18] (cd _build/default && /usr/bin/diff -u src/yaml/index.mld src/yaml/.mdx/index.mld.corrected) [00:00:18] --- src/yaml/index.mld 2025-01-20 09:36:00.272908858 +0000 [00:00:18] +++ src/yaml/.mdx/index.mld.corrected 2025-01-20 09:36:15.757077964 +0000 [00:00:18] @@ -28,22 +28,22 @@ [00:00:18] {@ocaml[ [00:00:18] type person = { name : string; age : int } [@@deriving yaml] [00:00:18] type users = person list [@@deriving yaml] [00:00:18] -]} [00:00:18] +][ [00:00:18] +{err@mdx-error[ [00:00:18] +Line 1, characters 56-60: [00:00:18] +Error: Cannot locate deriver yaml [00:00:18] +]err}]} [00:00:18] [00:00:18] This will produce four functions, a [_to_yaml] and [_of_yaml] for both a person and [00:00:18] the users. For example: [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # person_to_yaml;; [00:00:18] -- : person -> [00:00:18] - [> `O of (string * [> `Float of float | `String of string ]) list ] [00:00:18] -= <fun> [00:00:18] +Line 1, characters 1-15: [00:00:18] +Error: Unbound value person_to_yaml [00:00:18] # users_of_yaml;; [00:00:18] -- : [> `A of [00:00:18] - [> `O of (string * [> `Float of float | `String of string ]) list ] [00:00:18] - list ] -> [00:00:18] - (person list, [> `Msg of string ]) result [00:00:18] -= <fun> [00:00:18] +Line 1, characters 1-14: [00:00:18] +Error: Unbound value users_of_yaml [00:00:18] ]} [00:00:18] [00:00:18] If your type constructors have arguments, then the functions will be [00:00:18] @@ -52,22 +52,26 @@ [00:00:18] [00:00:18] {@ocaml[ [00:00:18] type 'a note = { txt : 'a } [@@deriving yaml] [00:00:18] -]} [00:00:18] +][ [00:00:18] +{err@mdx-error[ [00:00:18] +Line 1, characters 41-45: [00:00:18] +Error: Cannot locate deriver yaml [00:00:18] +]err}]} [00:00:18] [00:00:18] produces the following function. [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # note_to_yaml;; [00:00:18] -- : ('a -> Yaml.value) -> 'a note -> [> `O of (string * Yaml.value) list ] = [00:00:18] -<fun> [00:00:18] +Line 1, characters 1-13: [00:00:18] +Error: Unbound value note_to_yaml [00:00:18] ]} [00:00:18] [00:00:18] Finally, if you only need the encoder ([to_yaml]) or the decoder ([of_yaml]) then there are single versions of the deriver for those. [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # type x = { age : int }[@@deriving to_yaml];; [00:00:18] -type x = { age : int; } [00:00:18] -val x_to_yaml : x -> [> `O of (string * [> `Float of float ]) list ] = <fun> [00:00:18] +Line 1, characters 35-42: [00:00:18] +Error: Cannot locate deriver to_yaml [00:00:18] ]} [00:00:18] [00:00:18] {1 Attributes} [00:00:18] @@ -83,11 +87,12 @@ [00:00:18] # type t = { [00:00:18] camel_name : string [@key "camel-name"] [00:00:18] }[@@deriving to_yaml];; [00:00:18] -type t = { camel_name : string; } [00:00:18] -val to_yaml : t -> [> `O of (string * [> `String of string ]) list ] = <fun> [00:00:18] +Line 3, characters 16-23: [00:00:18] +Error: Cannot locate deriver to_yaml [00:00:18] [00:00:18] # Yaml.to_string_exn (to_yaml { camel_name = "Alice" });; [00:00:18] -- : string = "camel-name: Alice\n" [00:00:18] +Line 1, characters 21-28: [00:00:18] +Error: Unbound value to_yaml [00:00:18] ]} [00:00:18] [00:00:18] {2 Default Values} [00:00:18] @@ -99,13 +104,18 @@ [00:00:18] name : string; [00:00:18] age : int [@default 42] [00:00:18] }[@@deriving yaml] [00:00:18] -]} [00:00:18] +][ [00:00:18] +{err@mdx-error[ [00:00:18] +Line 4, characters 16-20: [00:00:18] +Error: Cannot locate deriver yaml [00:00:18] +]err}]} [00:00:18] [00:00:18] These will be used in the absence of any fields when decoding Yaml values into OCaml ones. [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # Yaml.of_string_exn "name: Alice" |> of_yaml;; [00:00:18] -- : (t, [> `Msg of string ]) result = Ok {name = "Alice"; age = 42} [00:00:18] +Line 1, characters 37-44: [00:00:18] +Error: Unbound value of_yaml [00:00:18] ]} [00:00:18] [00:00:18] {2 Custom encoding and decoding} [00:00:18] @@ -117,13 +127,18 @@ [00:00:18] type t = { [00:00:18] name : string [@to_yaml fun i -> `String ("custom-" ^ i)] [00:00:18] }[@@deriving yaml] [00:00:18] -]} [00:00:18] +][ [00:00:18] +{err@mdx-error[ [00:00:18] +Line 3, characters 16-20: [00:00:18] +Error: Cannot locate deriver yaml [00:00:18] +]err}]} [00:00:18] [00:00:18] The [to_yaml] function will use the custom encoder now instead. [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # Yaml.to_string_exn (to_yaml { name = "alice" });; [00:00:18] -- : string = "name: custom-alice\n" [00:00:18] +Line 1, characters 21-28: [00:00:18] +Error: Unbound value to_yaml [00:00:18] ]} [00:00:18] [00:00:18] {1 Partially Decoding} [00:00:18] @@ -145,14 +160,13 @@ [00:00:18] name : string; [00:00:18] age : int; [00:00:18] }[@@deriving of_yaml];; [00:00:18] -type t = { name : string; age : int; } [00:00:18] -val of_yaml : [00:00:18] - [> `O of (string * [> `Float of float | `String of string ]) list ] -> [00:00:18] - (t, [> `Msg of string ]) result = <fun> [00:00:18] +Line 4, characters 16-23: [00:00:18] +Error: Cannot locate deriver of_yaml [00:00:18] [00:00:18] # Yaml.of_string_exn yaml |> of_yaml;; [00:00:18] -- : (t, [> `Msg of string ]) result = [00:00:18] -Error (`Msg "Failed to find the case for: misc") [00:00:18] +Line 1, characters 28-35: [00:00:18] +Error: Unbound value of_yaml [00:00:18] +Hint: Did you mean yaml? [00:00:18] ]} [00:00:18] [00:00:18] Instead we tell the deriver to ignore unknown fields. [00:00:18] @@ -162,11 +176,17 @@ [00:00:18] name : string; [00:00:18] age : int; [00:00:18] }[@@deriving of_yaml ~skip_unknown] [00:00:18] -]} [00:00:18] +][ [00:00:18] +{err@mdx-error[ [00:00:18] +Line 4, characters 16-23: [00:00:18] +Error: Cannot locate deriver of_yaml [00:00:18] +]err}]} [00:00:18] [00:00:18] {@ocaml[ [00:00:18] # Yaml.of_string_exn yaml |> of_yaml;; [00:00:18] -- : (t, [> `Msg of string ]) result = Ok {name = "Bob"; age = 42} [00:00:18] +Line 1, characters 28-35: [00:00:18] +Error: Unbound value of_yaml [00:00:18] +Hint: Did you mean yaml? [00:00:18] ]} [00:00:18] [00:00:18] {1 Implementation Details} [00:00:18] error: Bad exit status from /usr/src/tmp/rpm-tmp.98114 (%check)
On x86_64 there is no failure.
Temporary build log: https://git.altlinux.org/tasks/369889/build/1500/i586/log
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Tests fail on x86 (32-bit arch):
On x86_64 there is no failure.
Temporary build log: https://git.altlinux.org/tasks/369889/build/1500/i586/log
The text was updated successfully, but these errors were encountered: