author | Alan Dipert
<alan@dipert.org> 2019-08-22 08:01:47 UTC |
committer | Alan Dipert
<alan@dipert.org> 2019-08-22 08:01:47 UTC |
parent | 1079c491b88590dfa81e68470117f336e5861821 |
jacl-tests.js | +15 | -2 |
diff --git a/jacl-tests.js b/jacl-tests.js index aa94009..0f056c0 100644 --- a/jacl-tests.js +++ b/jacl-tests.js @@ -78,18 +78,31 @@ QUnit.test('Conses', async is => { /Nothing after . in list/, 'nothing after dot' ); - [rdr, read1] = freshRdr(is); + is.rejects( read1('( . t)', false), /Nothing before . in list/, 'nothing before dot' ); - [rdr, read1] = freshRdr(is); + is.rejects( read1('(1 . 2 3)', false), /More than one object after . in list/, 'more than one object after dot' ); + [rdr, read1] = freshRdr(is); + + cons = await read1('(1 2 3 4)'); + is.deepEqual(Array.from(cons), [1,2,3,4], 'convert to array'); + + cons = await read1('(1 . 2)'); + is.deepEqual(Array.from(cons), [1,2], 'convert to pair'); + + cons = await read1('((1 . 2))'); + is.deepEqual(Array.from(cons), [[1,2]], 'convert to nested pair'); + + cons = await read1('(1 (2 . 3) 4)'); + is.deepEqual(Array.from(cons), [1,[2,3],4], 'convert to nested array'); });