2023-12-01 01:03:42 +03:00
|
|
|
# Tests for `move`
|
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> builtins.merge
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Happy Path - namespace, term, and type
|
|
|
|
|
|
|
|
Create a term, type, and namespace with history
|
|
|
|
|
|
|
|
```unison
|
|
|
|
Foo = 2
|
|
|
|
unique type Foo = Foo
|
|
|
|
Foo.termInA = 1
|
|
|
|
unique type Foo.T = T
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
```unison
|
|
|
|
Foo.termInA = 2
|
|
|
|
unique type Foo.T = T1 | T2
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> update
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Should be able to move the term, type, and namespace, including its types, terms, and sub-namespaces.
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> move Foo Bar
|
|
|
|
scratch/main> ls
|
|
|
|
scratch/main> ls Bar
|
|
|
|
scratch/main> history Bar
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Happy Path - Just term
|
|
|
|
|
|
|
|
```unison
|
|
|
|
bonk = 5
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:31:09 +03:00
|
|
|
z/main> builtins.merge
|
|
|
|
z/main> add
|
|
|
|
z/main> move bonk zonk
|
|
|
|
z/main> ls
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Happy Path - Just namespace
|
|
|
|
|
|
|
|
```unison
|
|
|
|
bonk.zonk = 5
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:31:09 +03:00
|
|
|
a/main> builtins.merge
|
|
|
|
a/main> add
|
|
|
|
a/main> move bonk zonk
|
|
|
|
a/main> ls
|
|
|
|
a/main> view zonk.zonk
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Sad Path - No term, type, or namespace named src
|
|
|
|
|
|
|
|
```ucm:error
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> move doesntexist foo
|
2023-12-01 01:03:42 +03:00
|
|
|
```
|