uzu: stacks now work within () + write more tests
This commit is contained in:
parent
dbe3915368
commit
b71b1354c3
2 changed files with 41 additions and 13 deletions
|
|
@ -58,13 +58,32 @@ let desguar = (a) => {
|
|||
|
||||
describe('uzu sugar', () => {
|
||||
it('should desugar []', () => expect(desguar('[a b c]')).toEqual('(seq a b c)'));
|
||||
it('should desugar [] nested', () => expect(desguar('[a [b c]]')).toEqual('(seq a (seq b c))'));
|
||||
it('should desugar [] nested', () => expect(desguar('[a [b c] d]')).toEqual('(seq a (seq b c) d)'));
|
||||
it('should desugar <>', () => expect(desguar('<a b c>')).toEqual('(cat a b c)'));
|
||||
it('should desugar <> nested', () => expect(desguar('<a <b c>>')).toEqual('(cat a (cat b c))'));
|
||||
it('should desugar <> nested', () => expect(desguar('<a <b c> d>')).toEqual('(cat a (cat b c) d)'));
|
||||
it('should desugar mixed [] <>', () => expect(desguar('[a <b c>]')).toEqual('(seq a (cat b c))'));
|
||||
it('should desugar mixed <> []', () => expect(desguar('<a [b c]>')).toEqual('(cat a (seq b c))'));
|
||||
|
||||
it('should desugar .', () => expect(desguar('s jazz . fast 2')).toEqual('(fast (s jazz) 2)'));
|
||||
it('should desugar . seq', () => expect(desguar('[bd cp . fast 2]')).toEqual('(fast (seq bd cp) 2)'));
|
||||
it('should desugar . twice', () => expect(desguar('s jazz . fast 2 . slow 2')).toEqual('(slow (fast (s jazz) 2) 2)'));
|
||||
it('should desugar . nested', () => expect(desguar('(s cp . fast 2)')).toEqual('(fast (s cp) 2)'));
|
||||
it('should desugar . within []', () => expect(desguar('[bd cp . fast 2]')).toEqual('(fast (seq bd cp) 2)'));
|
||||
it('should desugar . within , within []', () =>
|
||||
expect(desguar('[bd cp . fast 2, x]')).toEqual('(stack (fast (seq bd cp) 2) x)'));
|
||||
|
||||
it('should desugar . ()', () => expect(desguar('[jazz hh.(fast 2)]')).toEqual('(seq jazz (fast hh 2))'));
|
||||
|
||||
it('should desugar , seq', () => expect(desguar('[bd, hh]')).toEqual('(stack bd hh)'));
|
||||
it('should desugar , seq 2', () => expect(desguar('[bd, hh oh]')).toEqual('(stack bd (seq hh oh))'));
|
||||
it('should desugar , seq 3', () => expect(desguar('[bd cp, hh oh]')).toEqual('(stack (seq bd cp) (seq hh oh))'));
|
||||
it('should desugar , cat', () => expect(desguar('<bd, hh>')).toEqual('(stack bd hh)'));
|
||||
it('should desugar , cat 2', () => expect(desguar('<bd, hh oh>')).toEqual('(stack bd (cat hh oh))'));
|
||||
it('should desugar , cat 3', () => expect(desguar('<bd cp, hh oh>')).toEqual('(stack (cat bd cp) (cat hh oh))'));
|
||||
it('should desugar , ()', () => expect(desguar('(s bd, s cp)')).toEqual('(stack (s bd) (s cp))'));
|
||||
it('should desugar * /', () => expect(desguar('[a b*2 c d/3 e]')).toEqual('(seq a (* b 2) c (/ d 3) e)'));
|
||||
it('should desugar []*x', () => expect(desguar('[a [b c]*3]')).toEqual('(seq a (* (seq b c) 3))'));
|
||||
|
||||
it('should desugar README example', () =>
|
||||
expect(desguar('s [bd hh*2 cp.(crush 4) <mt ht lt>] . speed .8')).toEqual(
|
||||
'(speed (s (seq bd (* hh 2) (crush cp 4) (cat mt ht lt))) .8)',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue