diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-08-14 08:56:18 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 7a7db7e0b2f3782a90528f6dbdf84ecd0ce47291 (patch) | |
| tree | 9a024d9b3fa7bd993462bec5a177d3314dcbc4df /spec | |
| parent | add vis/rgb (diff) | |
| download | alive-7a7db7e0b2f3782a90528f6dbdf84ecd0ce47291.tar.gz alive-7a7db7e0b2f3782a90528f6dbdf84ecd0ce47291.zip | |
document and spec Type member fields
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/type_spec.moon | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/type_spec.moon b/spec/type_spec.moon index 2ffdb49..0293385 100644 --- a/spec/type_spec.moon +++ b/spec/type_spec.moon @@ -10,6 +10,11 @@ describe 'Primitive', -> it 'inherits from Type', -> assert.is.equal Type, ancestor Primitive.__class + it 'exposes name', -> + assert.is.equal 'bool', bool.name + assert.is.equal 'num', num.name + assert.is.equal 'str', str.name + it 'stringifies well', -> assert.is.equal 'bool', tostring bool assert.is.equal 'num', tostring num @@ -48,6 +53,14 @@ describe 'Array', -> it 'inherits from Type', -> assert.is.equal Type, ancestor Array.__class + it 'exposes size', -> + assert.is.equal 3, vec3.size + assert.is.equal 2, str32.size + + it 'exposes inner type', -> + assert.is.equal num, vec3.type + assert.is.equal (Array 3, str), str32.type + it 'stringifies well', -> assert.is.equal 'num[3]', tostring vec3 assert.is.equal 'my-type[3][24]', tostring Array 24, Array 3, 'my-type' @@ -93,6 +106,10 @@ describe 'Struct', -> it 'inherits from Type', -> assert.is.equal Type, ancestor Struct.__class + it 'exposes inner types', -> + assert.is.same { note: str, dur: num }, play.types + assert.is.same { c: num, b: num, a: num }, abc.types + it 'stringifies well', -> assert.is.equal '{dur: num note: str}', tostring play assert.is.equal '{a: num b: num c: num}', tostring abc |
