mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-23 08:18:04 +03:00
reformat tests and add link test
This commit is contained in:
parent
e50045268a
commit
774d01fedf
@ -11,144 +11,185 @@ import Shellmet ()
|
||||
import qualified Unison.Test.Ucm as Ucm
|
||||
|
||||
test :: Test ()
|
||||
test = scope "codebase.upgrade12" $
|
||||
tests [typeAlias, topLevelTerm, subNamespace, accessPatch, accessHistory]
|
||||
test = scope "codebase.upgrade12" $ tests [
|
||||
scope "typeAlias" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
.> history
|
||||
.> history builtin
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```unison
|
||||
x : Nat
|
||||
x = 3
|
||||
```
|
||||
|]
|
||||
ok,
|
||||
|
||||
typeAlias :: Test ()
|
||||
typeAlias = scope "typeAlias" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
scope "topLevelTerm" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison:hide
|
||||
y = 3
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
.> history
|
||||
.> history builtin
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```unison
|
||||
x : Nat
|
||||
x = 3
|
||||
```
|
||||
|]
|
||||
ok
|
||||
|
||||
topLevelTerm :: Test ()
|
||||
topLevelTerm = scope "topLevelTerm" $ do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison:hide
|
||||
y = 3
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> find
|
||||
```
|
||||
```unison
|
||||
> y
|
||||
```
|
||||
|]
|
||||
ok
|
||||
|
||||
subNamespace :: Test ()
|
||||
subNamespace = scope "subNamespace" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
.> find
|
||||
```
|
||||
```unison
|
||||
unique type a.b.C = C Nat
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
> y
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> find
|
||||
```
|
||||
```unison
|
||||
> a.b.C.C 3
|
||||
```
|
||||
|]
|
||||
ok
|
||||
ok,
|
||||
|
||||
accessPatch :: Test ()
|
||||
accessPatch = scope "accessPatch" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
scope "metadataForTerm" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 ""
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison:hide
|
||||
doc = "y is the number 3"
|
||||
y = 3
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
.> link doc y
|
||||
```
|
||||
|]
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
```
|
||||
```unison:hide
|
||||
unique type A = A Nat
|
||||
foo = A.A 3
|
||||
.> links y
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> debug.file
|
||||
.> add
|
||||
```
|
||||
```unison:hide
|
||||
unique type A = A Nat Nat
|
||||
foo = A.A 3 3
|
||||
.> links y
|
||||
```
|
||||
|]
|
||||
ok,
|
||||
|
||||
scope "metadataForType" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison:hide
|
||||
doc = "Nat means natural number"
|
||||
```
|
||||
```ucm
|
||||
.> alias.type ##Nat Nat
|
||||
.> link doc Nat
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> debug.file
|
||||
.> update
|
||||
.> docs y
|
||||
```
|
||||
|]
|
||||
ok,
|
||||
|
||||
scope "subNamespace" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
```
|
||||
```unison
|
||||
unique type a.b.C = C Nat
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> find
|
||||
```
|
||||
```unison
|
||||
> a.b.C.C 3
|
||||
```
|
||||
|]
|
||||
ok,
|
||||
|
||||
scope "accessPatch" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> alias.type ##Nat builtin.Nat
|
||||
```
|
||||
```unison:hide
|
||||
unique type A = A Nat
|
||||
foo = A.A 3
|
||||
```
|
||||
```ucm
|
||||
.> debug.file
|
||||
.> add
|
||||
```
|
||||
```unison:hide
|
||||
unique type A = A Nat Nat
|
||||
foo = A.A 3 3
|
||||
```
|
||||
```ucm
|
||||
.> debug.file
|
||||
.> update
|
||||
```
|
||||
```ucm
|
||||
.> view.patch patch
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> view.patch patch
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> view.patch patch
|
||||
```
|
||||
|]
|
||||
ok
|
||||
ok,
|
||||
|
||||
-- #00k3c9bp6m A
|
||||
-- #6v94dtbfk1 foo
|
||||
-- #d3bn4dqp1a A'
|
||||
-- #p3a21bjjl4 foo'
|
||||
|
||||
accessHistory :: Test ()
|
||||
accessHistory = scope "history" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison
|
||||
foo = 3
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
```unison
|
||||
foo = 4
|
||||
```
|
||||
```ucm
|
||||
.> update
|
||||
.> history
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> history
|
||||
.> reset-root #ls8
|
||||
.> history
|
||||
```
|
||||
|]
|
||||
ok
|
||||
scope "history" do
|
||||
void $ io do
|
||||
c1 <- Ucm.initCodebase Ucm.CodebaseFormat1
|
||||
Ucm.runTranscript c1 Ucm.Runtime1 [i|
|
||||
```unison
|
||||
foo = 3
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
```unison
|
||||
foo = 4
|
||||
```
|
||||
```ucm
|
||||
.> update
|
||||
.> history
|
||||
```
|
||||
|]
|
||||
c2 <- Ucm.upgradeCodebase c1
|
||||
Ucm.runTranscript c2 Ucm.Runtime1 [i|
|
||||
```ucm
|
||||
.> history
|
||||
.> reset-root #ls8
|
||||
.> history
|
||||
```
|
||||
|]
|
||||
ok
|
||||
]
|
Loading…
Reference in New Issue
Block a user