From 27e57ad5b46e7edae454dbb74b70013fefe00eb9 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 9 May 2020 20:06:18 +0200 Subject: make tostring Scope deterministic and test it --- spec/scope_spec.moon | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'spec') 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 "", tostring sub + assert.is.equal "", 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 "", tostring scope + it 'wraps Values in from_table', -> pi = Constant.num 3.14 scope = Scope.from_table { -- cgit v1.2.3