mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-25 13:36:37 +00:00
fix expects
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
This commit is contained in:
parent
a671c4cdc9
commit
df58a4ff07
1 changed files with 9 additions and 7 deletions
|
|
@ -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
|
||||
## ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue