mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 02:55:19 +03:00
cleanup
This commit is contained in:
parent
a987756b41
commit
5a7e3b4932
@ -1,12 +1,3 @@
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
.> find
|
||||
```
|
||||
|
||||
```unison
|
||||
unique type EncDec = EncDec Text (Nat -> Bytes) (Bytes -> Optional (Nat, Bytes))
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
```unison
|
||||
unique type EncDec = EncDec Text (Nat -> Bytes) (Bytes -> Optional (Nat, Bytes))
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
|
||||
Test for code serialization operations.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
```
|
||||
|
||||
Define a function, serialize it, then deserialize it back to an actual
|
||||
function. Also ask for its dependencies for display later.
|
||||
|
||||
@ -138,8 +134,8 @@ verified name link =
|
||||
with handleTest ("verified " ++ name)
|
||||
|
||||
rejected : Text -> [(Link.Term,Code)] ->{io2.IO} Result
|
||||
rejected name rco =
|
||||
handle verify name rco
|
||||
rejected name rco =
|
||||
handle verify name rco
|
||||
with expectFailure ("rejected " ++ name)
|
||||
|
||||
missed : Text -> Link.Term -> Result
|
||||
|
@ -134,8 +134,8 @@ verified name link =
|
||||
with handleTest ("verified " ++ name)
|
||||
|
||||
rejected : Text -> [(Link.Term,Code)] ->{io2.IO} Result
|
||||
rejected name rco =
|
||||
handle verify name rco
|
||||
rejected name rco =
|
||||
handle verify name rco
|
||||
with expectFailure ("rejected " ++ name)
|
||||
|
||||
missed : Text -> Link.Term -> Result
|
||||
|
@ -1,9 +1,5 @@
|
||||
# Computable documents in Unison
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
```
|
||||
|
||||
Unison documentation is written in Unison and has some neat features:
|
||||
|
||||
* The documentation type provides a rich vocabulary of elements that go beyond markdown, including asides, callouts, tooltips, and more.
|
||||
|
@ -6,10 +6,6 @@ Exception ability directly, and the last is code validation. I don't
|
||||
have an easy way to test the last at the moment, but the other two are
|
||||
tested here.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
```
|
||||
|
||||
```unison
|
||||
test1 : '{IO, Exception} [Result]
|
||||
test1 = do
|
||||
|
@ -1,30 +0,0 @@
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
```
|
||||
|
||||
Tests some capabilities for catching runtime exceptions.
|
||||
|
||||
```unison
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
catcher act =
|
||||
handle tryEval act with cases
|
||||
{ raise _ -> _ } -> Ok "caught"
|
||||
{ _ } -> Fail "nothing to catch"
|
||||
|
||||
tests _ =
|
||||
[ catcher do
|
||||
_ = 1/0
|
||||
()
|
||||
, catcher '(bug "testing")
|
||||
, handle tryEval (do 1+1) with cases
|
||||
{ raise _ -> _ } -> Fail "1+1 failed"
|
||||
{ 2 } -> Ok "got the right answer"
|
||||
{ _ } -> Fail "got the wrong answer"
|
||||
]
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test tests
|
||||
```
|
||||
|
@ -1,56 +0,0 @@
|
||||
Tests some capabilities for catching runtime exceptions.
|
||||
|
||||
```unison
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
catcher act =
|
||||
handle tryEval act with cases
|
||||
{ raise _ -> _ } -> Ok "caught"
|
||||
{ _ } -> Fail "nothing to catch"
|
||||
|
||||
tests _ =
|
||||
[ catcher do
|
||||
_ = 1/0
|
||||
()
|
||||
, catcher '(bug "testing")
|
||||
, handle tryEval (do 1+1) with cases
|
||||
{ raise _ -> _ } -> Fail "1+1 failed"
|
||||
{ 2 } -> Ok "got the right answer"
|
||||
{ _ } -> Fail "got the wrong answer"
|
||||
]
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
||||
Loading changes detected in scratch.u.
|
||||
|
||||
I found and typechecked these definitions in scratch.u. If you
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
change:
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
tests : ∀ _. _ ->{IO} [Result]
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
tests : ∀ _. _ ->{IO} [Result]
|
||||
|
||||
.> io.test tests
|
||||
|
||||
New test results:
|
||||
|
||||
◉ tests caught
|
||||
◉ tests caught
|
||||
◉ tests got the right answer
|
||||
|
||||
✅ 3 test(s) passing
|
||||
|
||||
Tip: Use view tests to view the source of a test.
|
||||
|
||||
```
|
@ -1,12 +1,5 @@
|
||||
# Tests for TLS builtins
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
.> builtins.mergeio
|
||||
.> load unison-src/transcripts-using-base/base.u
|
||||
.> add
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
-- generated with:
|
||||
-- openssl req -newkey rsa:2048 -subj '/CN=test.unison.cloud/O=Unison/C=US' -nodes -keyout key.pem -x509 -days 3650 -out cert.pem
|
||||
|
@ -1,9 +1,5 @@
|
||||
Test for new Text -> Bytes conversions explicitly using UTF-8 as the encoding
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
```
|
||||
|
||||
Unison has function for converting between `Text` and a UTF-8 `Bytes` encoding of the Text.
|
||||
|
||||
```ucm
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
.> builtins.merge
|
||||
```
|
||||
|
||||
```unison
|
@ -54,33 +54,29 @@ myServer = unsafeRun! '(hello "127.0.0.1" "0")
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
change:
|
||||
|
||||
⊡ Previously added definitions will be ignored: Exception
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
structural type Either a b
|
||||
(also named builtin.Either)
|
||||
bugFail : Failure -> r
|
||||
hello : Text -> Text ->{IO, Exception} ()
|
||||
myServer : '{IO} ()
|
||||
putText : Handle -> Text ->{IO, Exception} ()
|
||||
reraise : Either Failure b ->{Exception} b
|
||||
(also named Exception.reraise)
|
||||
socketSend : Socket -> Bytes ->{IO, Exception} ()
|
||||
toException : Either Failure a ->{Exception} a
|
||||
(also named Exception.reraise)
|
||||
|
||||
⍟ These names already exist. You can `update` them to your
|
||||
new definition:
|
||||
|
||||
structural ability Exception
|
||||
(also named builtin.Exception)
|
||||
Exception.unsafeRun! : '{g, Exception} a -> '{g} a
|
||||
bugFail : Failure -> r
|
||||
closeSocket : Socket ->{IO, Exception} ()
|
||||
hello : Text -> Text ->{IO, Exception} ()
|
||||
myServer : '{IO} ()
|
||||
putBytes : Handle
|
||||
-> Bytes
|
||||
->{IO, Exception} ()
|
||||
putText : Handle -> Text ->{IO, Exception} ()
|
||||
reraise : Either Failure b ->{Exception} b
|
||||
serverSocket : Optional Text
|
||||
-> Text
|
||||
->{IO, Exception} Socket
|
||||
socketSend : Socket
|
||||
-> Bytes
|
||||
->{IO, Exception} ()
|
||||
toException : Either Failure a ->{Exception} a
|
||||
|
||||
```
|
||||
```ucm
|
@ -51,3 +51,29 @@ Fold.Stream.fold =
|
||||
res = Fold.Stream.fold (folds.all pred) (Stream.range 1 5)
|
||||
!res Universal.== false
|
||||
```
|
||||
|
||||
Tests some capabilities for catching runtime exceptions.
|
||||
|
||||
```unison
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
catcher act =
|
||||
handle tryEval act with cases
|
||||
{ raise _ -> _ } -> Ok "caught"
|
||||
{ _ } -> Fail "nothing to catch"
|
||||
|
||||
tests _ =
|
||||
[ catcher do
|
||||
_ = 1/0
|
||||
()
|
||||
, catcher '(bug "testing")
|
||||
, handle tryEval (do 1+1) with cases
|
||||
{ raise _ -> _ } -> Fail "1+1 failed"
|
||||
{ 2 } -> Ok "got the right answer"
|
||||
{ _ } -> Fail "got the wrong answer"
|
||||
]
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test tests
|
||||
```
|
||||
|
@ -85,3 +85,59 @@ Fold.Stream.fold =
|
||||
true
|
||||
|
||||
```
|
||||
Tests some capabilities for catching runtime exceptions.
|
||||
|
||||
```unison
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
catcher act =
|
||||
handle tryEval act with cases
|
||||
{ raise _ -> _ } -> Ok "caught"
|
||||
{ _ } -> Fail "nothing to catch"
|
||||
|
||||
tests _ =
|
||||
[ catcher do
|
||||
_ = 1/0
|
||||
()
|
||||
, catcher '(bug "testing")
|
||||
, handle tryEval (do 1+1) with cases
|
||||
{ raise _ -> _ } -> Fail "1+1 failed"
|
||||
{ 2 } -> Ok "got the right answer"
|
||||
{ _ } -> Fail "got the wrong answer"
|
||||
]
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
||||
Loading changes detected in scratch.u.
|
||||
|
||||
I found and typechecked these definitions in scratch.u. If you
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
change:
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
tests : ∀ _. _ ->{IO} [Result]
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
catcher : '{IO} () ->{IO} Result
|
||||
tests : ∀ _. _ ->{IO} [Result]
|
||||
|
||||
.> io.test tests
|
||||
|
||||
New test results:
|
||||
|
||||
◉ tests caught
|
||||
◉ tests caught
|
||||
◉ tests got the right answer
|
||||
|
||||
✅ 3 test(s) passing
|
||||
|
||||
Tip: Use view tests to view the source of a test.
|
||||
|
||||
```
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
```ucm
|
||||
.> display List.map
|
||||
```
|
||||
```
|
||||
|
@ -1,11 +1,11 @@
|
||||
```unison
|
||||
lexicalScopeEx: [Text]
|
||||
lexicalScopeEx =
|
||||
lexicalScopeEx =
|
||||
parent = "outer"
|
||||
inner1 = let
|
||||
inner1 = let
|
||||
child1 = "child1"
|
||||
inner2 : [Text]
|
||||
inner2 = let
|
||||
inner2 = let
|
||||
child2 = "child2"
|
||||
[parent, child1, child2]
|
||||
inner2
|
||||
|
@ -11,4 +11,3 @@ Ensure closing token is emitted by closing brace in doc eval block.
|
||||
```ucm:hide
|
||||
.> add
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user