Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbacquey committed Sep 12, 2024
1 parent 0ef5067 commit ffe3b3b
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 88 deletions.
74 changes: 42 additions & 32 deletions topiary-cli/tests/samples/expected/ocaml-interface.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2181,8 +2181,10 @@ module Tx_rollup_commitment : sig
val check_message_result :
context ->
Compact.t ->
[`Hash of Tx_rollup_message_result_hash.t
| `Result of Tx_rollup_message_result.t] ->
[
| `Hash of Tx_rollup_message_result_hash.t
| `Result of Tx_rollup_message_result.t
] ->
path: Merkle.path ->
index: int ->
context tzresult
Expand Down Expand Up @@ -2344,8 +2346,10 @@ module Tx_rollup_errors : sig
{
provided: Tx_rollup_message_result_hash.t;
expected:
[`Valid_path of Tx_rollup_commitment.Merkle.h * int
| `Hash of Tx_rollup_message_result_hash.t];
[
| `Valid_path of Tx_rollup_commitment.Merkle.h * int
| `Hash of Tx_rollup_message_result_hash.t
];
}
| Proof_undecodable
| Proof_failed_to_reject
Expand Down Expand Up @@ -5347,34 +5351,40 @@ end
(** This module re-exports definitions from {!Token}. *)
module Token : sig
type container = [`Contract of Contract.t
| `Collected_commitments of Blinded_public_key_hash.t
| `Delegate_balance of public_key_hash
| `Frozen_deposits of public_key_hash
| `Block_fees
| `Frozen_bonds of Contract.t * Bond_id.t]
type source = [`Invoice
| `Bootstrap
| `Initial_commitments
| `Revelation_rewards
| `Double_signing_evidence_rewards
| `Endorsing_rewards
| `Baking_rewards
| `Baking_bonuses
| `Minted
| `Liquidity_baking_subsidies
| `Tx_rollup_rejection_rewards
| `Sc_rollup_refutation_rewards
| container]
type sink = [`Storage_fees
| `Double_signing_punishments
| `Lost_endorsing_rewards of public_key_hash * bool * bool
| `Burned
| `Tx_rollup_rejection_punishments
| `Sc_rollup_refutation_punishments
| container]
type container = [
| `Contract of Contract.t
| `Collected_commitments of Blinded_public_key_hash.t
| `Delegate_balance of public_key_hash
| `Frozen_deposits of public_key_hash
| `Block_fees
| `Frozen_bonds of Contract.t * Bond_id.t
]
type source = [
| `Invoice
| `Bootstrap
| `Initial_commitments
| `Revelation_rewards
| `Double_signing_evidence_rewards
| `Endorsing_rewards
| `Baking_rewards
| `Baking_bonuses
| `Minted
| `Liquidity_baking_subsidies
| `Tx_rollup_rejection_rewards
| `Sc_rollup_refutation_rewards
| container
]
type sink = [
| `Storage_fees
| `Double_signing_punishments
| `Lost_endorsing_rewards of public_key_hash * bool * bool
| `Burned
| `Tx_rollup_rejection_punishments
| `Sc_rollup_refutation_punishments
| container
]
val allocated : context -> container -> (context * bool) tzresult Lwt.t
Expand Down
130 changes: 74 additions & 56 deletions topiary-cli/tests/samples/expected/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -620,25 +620,22 @@ let large_const =
->
val

let [a; _; _] =
[
1;
2;
3
]

let [|a; _; _|] =
[|
1;
2;
3
|]

let _ =
(
let x = 42 in
x
)
let [a; _; _] = [
1;
2;
3
]

let [|a; _; _|] = [|
1;
2;
3
|]

let _ = (
let x = 42 in
x
)

let _ =
let foo = fun x ->
Expand Down Expand Up @@ -690,10 +687,9 @@ and quoted_string_multiline_with_id =
World
{|!|}
|external}
let _ =
{
my_string = quoted_string ^ quoted_string_multiline_with_id
}
let _ = {
my_string = quoted_string ^ quoted_string_multiline_with_id
}

(* Tags in pattern matching *)
type my_box = [`Foo of int | `Bar of int]
Expand Down Expand Up @@ -850,12 +846,11 @@ type t = {
(** Boolean flags. *)
}

let _ =
{
verbose = 0;
loggers = "foo";
bflags = StrMap.empty
}
let _ = {
verbose = 0;
loggers = "foo";
bflags = StrMap.empty
}

type t = {
foo: bool; [@default false]
Expand Down Expand Up @@ -896,13 +891,12 @@ type message = {
payload: bytes;
}

let _ =
{
bar = 0.0;
foo = True
[@some tag]
[@some other_tag]
}
let _ = {
bar = 0.0;
foo = True
[@some tag]
[@some other_tag]
}

type controller =
| C : Slug.t -> controller
Expand All @@ -914,22 +908,20 @@ let _ =
let foo : #x y z = bar

(* Playing with nested structures *)
let _ =
(
1,
2,
3,
4
)

let _ =
(
1,
2,
(3, 4),
5,
6
)
let _ = (
1,
2,
3,
4
)

let _ = (
1,
2,
(3, 4),
5,
6
)

let x =
foo
Expand All @@ -943,10 +935,9 @@ let x =
bar;
bar

let _ =
{
foo = let bar = baz in bar
}
let _ = {
foo = let bar = baz in bar
}

(* #618: spacing/softlines in local opens *)
let _ =
Expand Down Expand Up @@ -1252,3 +1243,30 @@ let topiary _x = "Topiary"

print_string (topiary 27);
print_endline "!"

(* #730 consistency of opening brackets dangling *)
let foo = [|
1;
2;
3;
|]
let foo = [
1;
2;
3;
]
let foo = {
a = 1;
b = 2;
c = 3;
}
type bar = [
| `A
| `B
| `C
]
type bar = {
a: int;
b: int;
c: int;
}
27 changes: 27 additions & 0 deletions topiary-cli/tests/samples/input/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,3 +1184,30 @@ let topiary _x = "Topiary"

print_string (topiary 27);
print_endline "!"

(* #730 consistency of opening brackets dangling *)
let foo = [|
1;
2;
3;
|]
let foo = [
1;
2;
3;
]
let foo = {
a = 1;
b = 2;
c = 3;
}
type bar = [
| `A
| `B
| `C
]
type bar = {
a: int;
b: int;
c: int;
}

0 comments on commit ffe3b3b

Please sign in to comment.