diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-05-09 18:06:18 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:23:21 +0000 |
| commit | 27e57ad5b46e7edae454dbb74b70013fefe00eb9 (patch) | |
| tree | 51ed20e54c86e30ecd4f7a4a8707a48183b98d5e /spec | |
| parent | exclude Constants from side_inputs (diff) | |
| download | alive-27e57ad5b46e7edae454dbb74b70013fefe00eb9.tar.gz alive-27e57ad5b46e7edae454dbb74b70013fefe00eb9.zip | |
make tostring Scope deterministic and test it
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/scope_spec.moon | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/scope_spec.moon b/spec/scope_spec.moon index 637b5f5..b4a55f1 100644 --- a/spec/scope_spec.moon +++ b/spec/scope_spec.moon @@ -52,6 +52,23 @@ describe 'Scope', -> assert.is.equal pi, (got.value\get 'pi')\const! assert.is.equal pi, (scope\get 'math/pi')\const! + it 'stringifies well', -> + scope = Scope.from_table { + num: 3 + str: "im a happy string" + :pi + math: :pi + test: TestOp + } + sub = Scope Scope scope + + assert.is.equal "<Scope ^1 []>", tostring sub + assert.is.equal "<Scope ^-1 [math, num, str, test]>", tostring scope + scope\set_raw 'a', Constant.num 1 + scope\set_raw 'b', Constant.num 2 + scope\set_raw 'c', Constant.num 3 + assert.is.equal "<Scope ^-1 [a, b, c, math, num, …]>", tostring scope + it 'wraps Values in from_table', -> pi = Constant.num 3.14 scope = Scope.from_table { |
