From afaedeea23b7d3e874fc9c370340ace31d8e9b11 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 6 Nov 2025 21:39:51 -0800 Subject: [PATCH] probably using list.sort is okay? --- src/prelude/tests/prelude.test.ts | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/prelude/tests/prelude.test.ts b/src/prelude/tests/prelude.test.ts index 2794255..04ceb8b 100644 --- a/src/prelude/tests/prelude.test.ts +++ b/src/prelude/tests/prelude.test.ts @@ -454,31 +454,11 @@ describe('enumerables', () => { describe('dict operations', () => { test('dict.keys returns all keys', async () => { - const result = await (async () => { - const { Compiler } = await import('#compiler/compiler') - const { run, fromValue } = await import('reefvm') - const { setGlobals } = await import('#parser/tokenizer') - setGlobals(Object.keys(globals)) - const c = new Compiler('dict.keys [a=1 b=2 c=3]') - const r = await run(c.bytecode) - return fromValue(r) - })() - // Check that all expected keys are present (order may vary) - expect(result.sort()).toEqual(['a', 'b', 'c']) + await expect(`dict.keys [a=1 b=2 c=3] | list.sort`).toEvaluateTo(['a', 'b', 'c'].sort()) }) test('dict.values returns all values', async () => { - const result = await (async () => { - const { Compiler } = await import('#compiler/compiler') - const { run, fromValue } = await import('reefvm') - const { setGlobals } = await import('#parser/tokenizer') - setGlobals(Object.keys(globals)) - const c = new Compiler('dict.values [a=1 b=2]') - const r = await run(c.bytecode) - return fromValue(r) - })() - // Check that all expected values are present (order may vary) - expect(result.sort()).toEqual([1, 2]) + await expect('dict.values [a=1 b=2] | list.sort').toEvaluateTo([1, 2].sort()) }) test('dict.has? checks for key', async () => { @@ -489,6 +469,7 @@ describe('dict operations', () => { test('dict.get retrieves value with default', async () => { await expect(`dict.get [a=1] 'a' 0`).toEvaluateTo(1) await expect(`dict.get [a=1] 'b' 99`).toEvaluateTo(99) + await expect(`dict.get [a=1] 'b'`).toEvaluateTo(null) }) test('dict.set sets value', async () => {