From 7992a4e507af013ff7058792cee26bc11edc1434 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 25 May 2020 12:42:19 +0200 Subject: [PATCH] Added cased to test the pretty-printer. --- src/passes/1-parser/cameligo/Tests/pp.mligo | 72 ++++++++++++++------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/src/passes/1-parser/cameligo/Tests/pp.mligo b/src/passes/1-parser/cameligo/Tests/pp.mligo index ca4236e8f..1a70c1e6a 100644 --- a/src/passes/1-parser/cameligo/Tests/pp.mligo +++ b/src/passes/1-parser/cameligo/Tests/pp.mligo @@ -1,30 +1,56 @@ +let patch_ (m : foobar) : foobar = Map.literal [(0, 5); (1, 6); (2, 7)] + +(* +let (greet_num : int), (greeting : string), one_more_component = + different_types of_many_things + ffffff 124312 + +type storage = int * int + +let main (n : int * storage) + : operation list * storage = + let x : int * int = + let x : int = 7 + in x + n.0.asdasdasd.4, n.1.0 + n.1.1.1111111.aaaa.ddddddd.eeeeeee + in ([] : operation list), x + +let y : t = + if true then -30000 * 10000 - 100000 + f x x y y y y - ((x / 4000) * -5) else (10000 + 100000) / 10000000000 +type return = operation list * (storage * fsdgsdgf * sdfsdfsdf * ssdf) +let xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = + ttttttttttttt <= (aaaaaaaaaaaaaaaaaaaaaaaa - bbbbbbbbbbbbbbbbbbbb) +let x = tttt * ((fffffffff /55555555) - 3455 * 5135664) - 134 * (-4) +type x = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | B +let or_true (b : bool) : bool = bbbbbbbbbbbbb || true && cccccccccccccccccc +type x = A | B of t * int | CCC of int -> (string -> int) -> (string, address, timestamp, int) map +let c = CCCCCCCCCCCC (aaaaa, BBBBBBBBB aaaaaaaaaaaa) +let e = Some (a, B b) +type w = timestamp * nat -> (string, address) map -> t +type v = int * (a_long_type_name * (another_long_one * address * and_so_on) * more_of_a_very_long_type) + type r = int list type t = int -type s = (int,address) map -type w = timestamp * nat -> (string, address) map -> t -type v = int * (string * address) -type u = {a: int; b: t * char} -type q = {a: int; b: {c: string}} -type x = A | B of t * int | C of int -> (string -> int) -type y = "foo" -let x (_, (y: char)) = 4 -let y {x=(_,y); z=3} = x +type s = (int,address,a_long_type_name, more_of_a_very_long_type * foo_bar_baz) t +type q = {a: int; b: {c: string}; c: timestamp * (address, string) big_map -> longer_type_name} +type u = {a: int; b: t * char; c: int * (a_long_type_name * (another_long_one * address * and_so_on) * more_of_a_very_long_type)} +let f xxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyy zzzzzzzzzzz ttttt : type_annotation_which_is_very_verbose = this_too_short_a_variable +let g : type_annotation_which_is_very_verbose = fun x y z t -> this_too_short_a_variable [@@inline] +let yyyyyyyyyyy : a_very_long_and_specific_type_of_string = "foo and bar" +let rec x (_, (yyyyyyyyyyyyyyyy: tttttttttttttttttttttttt), very_long_variable_to_trigger_a_break) = 4 +let y {xxxxxxxxx=(_,yyyyyyyy,more_components,another_one); zzzzzzz=34444444; ttttttt=3n} = xxxxxx let z : (t) = y -let w = - match f 3 with - None -> [] - | Some (1::[2;3]) -> [4;5]::[] -let y : t = (if true then -3 + f x x else 0) - 1 -let f (x: int) y = (x : int) +let f (xxxxxxxxxxx: tttttttttttttt) y = (xxxxxxxxxxxx : tttttttttttttttttt) let n : nat = 0n let a = A let b = B a -let c = C (a, B (a)) let d = None -let e = Some (a, B b) -let z = z.1.2 -let v = "hello" ^ "world" ^ "!" -let w = Map.literal [(1,"1"); (2,"2")] - -let r = { field = 0} -let r = { r with field = 42} +let z = let v = "hello" ^ "world" ^ "!" in v +let r = { field = 0; another = 11111111111111111; and_another_one = "dddddd"} +let r = { r with field = 42; another = 11111111111111111; and_another_one = "dddddddddddddddddddddd"} +let w = Map.literal [(11111111111111,"11111111111111"); (22222222222,"22222222222222222"); (1234567890,"1234567890")] +let z = z.1.a.0.4.c.6.7.8.9.cccccccccccc.ccccccccccccccccc.ddddddddddddddddd.0.1.2 +let y : t = (if true then -30000000000000 + f x x y y y y else 10000000000000000000) - 1 +let w = + match f 3 with + None -> [] + | Some (1::[2;3;4;5;6]) -> [4;5]::[] + *)