mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51: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
|
# adapted from https://github.com/koka-lang/koka/blob/master/test/bench/haskell/cfold.hs
|
||||||
main : Task {} []
|
main : Task {} []
|
||||||
main =
|
main =
|
||||||
inputResult <- Task.attempt PlatformTask.getInt
|
{ value, isError } = PlatformTask.getInt!
|
||||||
|
inputResult =
|
||||||
|
if isError then
|
||||||
|
Err GetIntError
|
||||||
|
else
|
||||||
|
Ok value
|
||||||
|
|
||||||
when inputResult is
|
when inputResult is
|
||||||
Ok n ->
|
Ok n ->
|
||||||
|
|
|
@ -7,7 +7,12 @@ IO a : Task a []
|
||||||
|
|
||||||
main : Task {} []
|
main : Task {} []
|
||||||
main =
|
main =
|
||||||
inputResult <- Task.attempt PlatformTask.getInt
|
{ value, isError } = PlatformTask.getInt!
|
||||||
|
inputResult =
|
||||||
|
if isError then
|
||||||
|
Err GetIntError
|
||||||
|
else
|
||||||
|
Ok value
|
||||||
|
|
||||||
when inputResult is
|
when inputResult is
|
||||||
Ok n ->
|
Ok n ->
|
||||||
|
|
|
@ -4,7 +4,12 @@ import pf.PlatformTask
|
||||||
|
|
||||||
main : Task {} []
|
main : Task {} []
|
||||||
main =
|
main =
|
||||||
inputResult = Task.getInt!
|
{ value, isError } = PlatformTask.getInt!
|
||||||
|
inputResult =
|
||||||
|
if isError then
|
||||||
|
Err GetIntError
|
||||||
|
else
|
||||||
|
Ok value
|
||||||
|
|
||||||
when inputResult is
|
when inputResult is
|
||||||
Ok n ->
|
Ok n ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
hosted
|
hosted PlatformTask
|
||||||
exposes [putLine, putInt, getInt]
|
exposes [putLine, putInt, getInt]
|
||||||
imports []
|
imports []
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,12 @@ fold = \f, tree, b ->
|
||||||
|
|
||||||
main : Task {} []
|
main : Task {} []
|
||||||
main =
|
main =
|
||||||
inputResult = PlatformTask.getInt!
|
{ value, isError } = PlatformTask.getInt!
|
||||||
|
inputResult =
|
||||||
|
if isError then
|
||||||
|
Err GetIntError
|
||||||
|
else
|
||||||
|
Ok value
|
||||||
|
|
||||||
when inputResult is
|
when inputResult is
|
||||||
Ok n ->
|
Ok n ->
|
||||||
|
|
|
@ -7,15 +7,6 @@ main : Task {} []
|
||||||
main =
|
main =
|
||||||
PlatformTask.putLine! (showBool test1)
|
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 : Bool -> Str
|
||||||
showBool = \b ->
|
showBool = \b ->
|
||||||
if
|
if
|
||||||
|
|
|
@ -10,8 +10,8 @@ main =
|
||||||
when Base64.fromBytes (Str.toUtf8 "Hello World") is
|
when Base64.fromBytes (Str.toUtf8 "Hello World") is
|
||||||
Err _ -> PlatformTask.putLine "sadness"
|
Err _ -> PlatformTask.putLine "sadness"
|
||||||
Ok encoded ->
|
Ok encoded ->
|
||||||
Task.putLine! (Str.concat "encoded: " encoded)
|
PlatformTask.putLine! (Str.concat "encoded: " encoded)
|
||||||
|
|
||||||
when Base64.toStr encoded is
|
when Base64.toStr encoded is
|
||||||
Ok decoded -> Task.putLine (Str.concat "decoded: " decoded)
|
Ok decoded -> PlatformTask.putLine (Str.concat "decoded: " decoded)
|
||||||
Err _ -> Task.putLine "sadness"
|
Err _ -> PlatformTask.putLine "sadness"
|
||||||
|
|
|
@ -745,11 +745,11 @@ mod cli_run {
|
||||||
r#"
|
r#"
|
||||||
Compiled in <ignored for test> ms.
|
Compiled in <ignored for test> ms.
|
||||||
|
|
||||||
Direct.roc:
|
|
||||||
0 failed and 2 passed in <ignored for test> ms.
|
|
||||||
|
|
||||||
Transitive.roc:
|
Transitive.roc:
|
||||||
0 failed and 1 passed in <ignored for test> ms.
|
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