unison/unison-src/transcripts/move-namespace.md
2024-07-10 10:52:39 -07:00

2.2 KiB

Tests for move.namespace

Moving the Root

I should be able to move the root into a sub-namespace

foo = 1
scratch/main> add
-- Should request confirmation
scratch/main> move.namespace . .root.at.path
scratch/main> move.namespace . .root.at.path
scratch/main> ls
scratch/main> history
scratch/main> ls .root.at.path
scratch/main> history .root.at.path

I should be able to move a sub namespace over the root.

-- Should request confirmation
scratch/main> move.namespace .root.at.path .
scratch/main> move.namespace .root.at.path .
scratch/main> ls
scratch/main> history
-- should be empty
scratch/main> ls .root.at.path
scratch/main> history .root.at.path
scratch/happy> builtins.merge lib.builtins

Happy path

Create a namespace and add some history to it

a.termInA = 1
unique type a.T = T
scratch/happy> add
a.termInA = 2
unique type a.T = T1 | T2
scratch/happy> update

Should be able to move the namespace, including its types, terms, and sub-namespaces.

scratch/happy> move.namespace a b
scratch/happy> ls b
scratch/happy> history b

Namespace history

scratch/history> builtins.merge lib.builtins

Create some namespaces and add some history to them

a.termInA = 1
b.termInB = 10
scratch/history> add
a.termInA = 2
b.termInB = 11
scratch/history> update

Deleting a namespace should not leave behind any history, if we move another to that location we expect the history to simply be the history of the moved namespace.

scratch/history> delete.namespace b
scratch/history> move.namespace a b
-- Should be the history from 'a'
scratch/history> history b
-- Should be empty
scratch/history> history a

Moving over an existing branch

scratch/existing> builtins.merge lib.builtins

Create some namespace and add some history to them

a.termInA = 1
b.termInB = 10
scratch/existing> add
a.termInA = 2
b.termInB = 11
scratch/existing> update
scratch/existing> move.namespace a b