mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Fix all tests that don't depend on basic-cli
This commit is contained in:
parent
4b7d9c9222
commit
5ea6a8bdcd
8 changed files with 31 additions and 20 deletions
|
@ -5,7 +5,12 @@ import pf.PlatformTask
|
|||
# adapted from https://github.com/koka-lang/koka/blob/master/test/bench/haskell/cfold.hs
|
||||
main : Task {} []
|
||||
main =
|
||||
inputResult <- Task.attempt PlatformTask.getInt
|
||||
{ value, isError } = PlatformTask.getInt!
|
||||
inputResult =
|
||||
if isError then
|
||||
Err GetIntError
|
||||
else
|
||||
Ok value
|
||||
|
||||
when inputResult is
|
||||
Ok n ->
|
||||
|
|
|
@ -7,7 +7,12 @@ IO a : Task a []
|
|||
|
||||
main : Task {} []
|
||||
main =
|
||||
inputResult <- Task.attempt PlatformTask.getInt
|
||||
{ value, isError } = PlatformTask.getInt!
|
||||
inputResult =
|
||||
if isError then
|
||||
Err GetIntError
|
||||
else
|
||||
Ok value
|
||||
|
||||
when inputResult is
|
||||
Ok n ->
|
||||
|
|
|
@ -4,7 +4,12 @@ import pf.PlatformTask
|
|||
|
||||
main : Task {} []
|
||||
main =
|
||||
inputResult = Task.getInt!
|
||||
{ value, isError } = PlatformTask.getInt!
|
||||
inputResult =
|
||||
if isError then
|
||||
Err GetIntError
|
||||
else
|
||||
Ok value
|
||||
|
||||
when inputResult is
|
||||
Ok n ->
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
hosted
|
||||
hosted PlatformTask
|
||||
exposes [putLine, putInt, getInt]
|
||||
imports []
|
||||
|
||||
|
|
|
@ -39,7 +39,12 @@ fold = \f, tree, b ->
|
|||
|
||||
main : Task {} []
|
||||
main =
|
||||
inputResult = PlatformTask.getInt!
|
||||
{ value, isError } = PlatformTask.getInt!
|
||||
inputResult =
|
||||
if isError then
|
||||
Err GetIntError
|
||||
else
|
||||
Ok value
|
||||
|
||||
when inputResult is
|
||||
Ok n ->
|
||||
|
|
|
@ -7,15 +7,6 @@ main : Task {} []
|
|||
main =
|
||||
PlatformTask.putLine! (showBool test1)
|
||||
|
||||
n = PlatformTask.getInt!
|
||||
when n is
|
||||
1 ->
|
||||
PlatformTask.putLine (showBool test1)
|
||||
|
||||
_ ->
|
||||
ns = Num.toStr n
|
||||
PlatformTask.putLine "No test $(ns)"
|
||||
|
||||
showBool : Bool -> Str
|
||||
showBool = \b ->
|
||||
if
|
||||
|
|
|
@ -10,8 +10,8 @@ main =
|
|||
when Base64.fromBytes (Str.toUtf8 "Hello World") is
|
||||
Err _ -> PlatformTask.putLine "sadness"
|
||||
Ok encoded ->
|
||||
Task.putLine! (Str.concat "encoded: " encoded)
|
||||
PlatformTask.putLine! (Str.concat "encoded: " encoded)
|
||||
|
||||
when Base64.toStr encoded is
|
||||
Ok decoded -> Task.putLine (Str.concat "decoded: " decoded)
|
||||
Err _ -> Task.putLine "sadness"
|
||||
Ok decoded -> PlatformTask.putLine (Str.concat "decoded: " decoded)
|
||||
Err _ -> PlatformTask.putLine "sadness"
|
||||
|
|
|
@ -745,11 +745,11 @@ mod cli_run {
|
|||
r#"
|
||||
Compiled in <ignored for test> ms.
|
||||
|
||||
Direct.roc:
|
||||
0 failed and 2 passed in <ignored for test> ms.
|
||||
|
||||
Transitive.roc:
|
||||
0 failed and 1 passed in <ignored for test> ms.
|
||||
|
||||
Direct.roc:
|
||||
0 failed and 2 passed in <ignored for test> ms.
|
||||
"#
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue