From df58a4ff07470ef1ef3befab3dd14e5e10405ad0 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:56:34 +0100 Subject: [PATCH] fix expects Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com> --- crates/compiler/builtins/roc/Encode.roc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/compiler/builtins/roc/Encode.roc b/crates/compiler/builtins/roc/Encode.roc index 00061c9af3..a337fa9bb3 100644 --- a/crates/compiler/builtins/roc/Encode.roc +++ b/crates/compiler/builtins/roc/Encode.roc @@ -77,9 +77,10 @@ EncoderFormatting implements ## ## ``` ## expect -## customEncoder = Encode.custom (\bytes, _fmt -> bytes ++ [42]) # Appends the byte 42 to the list -## actual = Encode.appendWith [] customEncoder Json.format -## expected = [42] # Expected result is a list with a single byte, 42 +## customEncoder = Encode.custom (\bytes, _fmt -> List.concat bytes [42]) # Appends the byte 42 to the list +## +## actual = Encode.appendWith [] customEncoder Core.json +## expected = [42] # Expected result is a list with a single byte, 42 ## ## actual == expected ## ``` @@ -93,10 +94,10 @@ appendWith = \lst, @Encoder doEncoding, fmt -> doEncoding lst fmt ## ## ``` ## expect -## actual = Encode.append [] {foo: "Bar"} Json.format +## actual = Encode.append [] { foo: "Bar" } Core.json ## ## # Check that the list has grown -## List.length actual > 0 +## !(List.isEmpty actual) ## ``` append : List U8, val, fmt -> List U8 where val implements Encoding, fmt implements EncoderFormatting append = \lst, val, fmt -> appendWith lst (toEncoder val) fmt @@ -106,8 +107,9 @@ append = \lst, val, fmt -> appendWith lst (toEncoder val) fmt ## ``` ## expect ## value = 42 -## actual = Encode.toBytes value Json.format -## expected = [34, 52, 50, 34] # ASCII codes for '"42"' +## +## actual = Encode.toBytes value Core.json +## expected = [52, 50] # ASCII codes for 4 and 2 ## ## actual == expected ## ```