diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-09-03 21:57:44 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-09-14 15:39:20 +0000 |
| commit | 0b17ec3df2b4ad24e60ee43972ae66e273206304 (patch) | |
| tree | 93273e38ef0c06d31270c0067683e0f7beab4955 /spec | |
| parent | lib/love: fix event polling (diff) | |
| download | alive-0b17ec3df2b4ad24e60ee43972ae66e273206304.tar.gz alive-0b17ec3df2b4ad24e60ee43972ae66e273206304.zip | |
refactor Tag/Registry, reuse deleted tags
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/internal/cell_spec.moon | 8 | ||||
| -rw-r--r-- | spec/internal/rtnode_spec.moon | 2 | ||||
| -rw-r--r-- | spec/internal/tag_spec.moon | 25 | ||||
| -rw-r--r-- | spec/test_setup.moon | 4 |
4 files changed, 20 insertions, 19 deletions
diff --git a/spec/internal/cell_spec.moon b/spec/internal/cell_spec.moon index c9ccb39..bcc5700 100644 --- a/spec/internal/cell_spec.moon +++ b/spec/internal/cell_spec.moon @@ -1,6 +1,6 @@ import do_setup from require 'spec.test_setup' import Cell, RootCell from require 'alv.cell' -import Constant, Scope, Tag, SimpleRegistry, globals from require 'alv' +import Constant, Scope, Tag, globals from require 'alv' setup do_setup @@ -13,7 +13,7 @@ two_plus_two = Cell.parse Tag.parse('3'), { describe 'Cell', -> describe 'when cloned', -> - parent = Tag.blank '1' + parent = Tag! with hello_world\clone parent it 'keeps children', -> assert.is.equal Cell, .__class @@ -38,9 +38,9 @@ describe 'Cell', -> assert.spy(s).was_called_with (match.is_ref head), (match.is_ref globals) describe 'RootCell', -> - test 'tag is always [0]', -> + test 'tag is always [root]', -> cell = RootCell\parse {} - assert.is.equal '[0]', cell.tag\stringify! + assert.is.equal '[root]', cell.tag\stringify! test 'head is always "do"', -> cell = RootCell\parse {} diff --git a/spec/internal/rtnode_spec.moon b/spec/internal/rtnode_spec.moon index f757067..dfade3e 100644 --- a/spec/internal/rtnode_spec.moon +++ b/spec/internal/rtnode_spec.moon @@ -1,5 +1,5 @@ import do_setup from require 'spec.test_setup' -import RTNode, Scope, SimpleRegistry from require 'alv' +import RTNode, Scope from require 'alv' import T, Input, Op, Constant from require 'alv.base' class IOOp extends Op diff --git a/spec/internal/tag_spec.moon b/spec/internal/tag_spec.moon index f92dca0..3fffcb7 100644 --- a/spec/internal/tag_spec.moon +++ b/spec/internal/tag_spec.moon @@ -1,8 +1,9 @@ -import do_setup from require 'spec.test_setup' +import do_setup, do_teardown from require 'spec.test_setup' import Tag from require 'alv.tag' import Registry from require 'alv.registry' -setup do_setup +before_each do_setup +after_each do_teardown describe 'Tag', -> describe 'should be constructable', -> @@ -14,7 +15,7 @@ describe 'Tag', -> assert.is.equal '2', tostring tag it 'as blank Tags', -> - tag = Tag.blank! + tag = Tag! assert tag assert.is.nil tag.value assert.is.equal '', tag\stringify! @@ -35,19 +36,19 @@ describe 'Tag', -> it 'but not from blank tags', -> parent = Tag.parse '1' - original = Tag.blank! + original = Tag! tag = original\clone parent do_asserts tag, '1.?' it 'with blank parent', -> - parent = Tag.blank! + parent = Tag! original = Tag.parse '2' tag = original\clone parent do_asserts tag, '?.2' it 'completely blank', -> - parent = Tag.blank! - original = Tag.blank! + parent = Tag! + original = Tag! tag = original\clone parent do_asserts tag, '?.?' @@ -59,17 +60,17 @@ describe 'Tag', -> clone = tag\clone Tag.parse '3' assert.has.error -> clone\set 42 - clone = tag\clone Tag.blank! + clone = tag\clone Tag! assert.has.error -> clone\set 42 it 'and stores the value', -> - blank = Tag.blank! + blank = Tag! blank\set 12 assert.is.equal blank.value, 12 it 'sets the original if cloned', -> - original = Tag.blank! + original = Tag! parent = Tag.parse '7' o_set = spy.on original, 'set' @@ -84,8 +85,8 @@ describe 'Tag', -> assert.is.equal original.value, 11 it 'requires the parent to be registered if cloned', -> - original = Tag.blank! - parent = Tag.blank! + original = Tag! + parent = Tag! clone = original\clone parent assert.has.error -> clone\set 11 diff --git a/spec/test_setup.moon b/spec/test_setup.moon index 53d1451..e58b53a 100644 --- a/spec/test_setup.moon +++ b/spec/test_setup.moon @@ -88,8 +88,8 @@ class TestPilot extends Copilot fake_cell = head: -> 'test_op' tail: -> tail - tag: Tag.blank! + tag: Tag! - COPILOT.active_module.registry\scan_ast fake_cell + COPILOT.active_module.registry\assign_tags! op_invoke\eval_cell fake_cell, Scope!, Constant.wrap op } |
